Class loading error when looking up security providers
Paul Sandoz
paul.sandoz at oracle.com
Wed Jun 13 06:58:03 PDT 2012
Hi Sean,
Looking at the code the problem is the class "com.sun.crypto.provider.SunJCE" is in the jdk.crypto module and the code to load crypto providers does:
ClassLoader cl;
if (Platform.isModuleMode()) {
cl = Platform.getBaseModuleLoader();
} else {
cl = ClassLoader.getSystemClassLoader();
}
Class<?> provClass;
if (cl != null) {
provClass = cl.loadClass(className);
} else {
provClass = Class.forName(className);
}
So it is using the CL of the jdk.base module, which cannot see classes from the jdk.crypto module.
As the comment in the source that occurs above the above snippet states, this area needs to start using services.
For a build of Jigsaw you can find which class belongs to which module by grep'ing the files in build/<arch>/moduleinfo/classlist for the class name.
Paul.
On Jun 13, 2012, at 3:00 PM, Sean Mullan wrote:
> I'm seeing several ClassNotFoundException errors when some of the security
> providers are loaded, ex: (using java.security.debug trace):
>
> ProviderConfig: Error loading provider com.sun.crypto.provider.SunJCE
> java.lang.ClassNotFoundException: com.sun.crypto.provider.SunJCE : requested by
> +jdk.auth+jdk.base+jdk.desktop+jdk.jndi+jdk.prefs+jdk.tls+sun.charsets+sun.localedata+sun.resources
> at org.openjdk.jigsaw.Loader.loadClass(Loader.java:116)
> at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
> at sun.security.jca.ProviderConfig$2.run(ProviderConfig.java:231)
> at sun.security.jca.ProviderConfig$2.run(ProviderConfig.java:207)
> at java.security.AccessController.doPrivileged(Native Method)
> at sun.security.jca.ProviderConfig.doLoadProvider(ProviderConfig.java:207)
> at sun.security.jca.ProviderConfig.getProvider(ProviderConfig.java:188)
> at sun.security.jca.ProviderList.getProvider(ProviderList.java:233)
> at sun.security.jca.ProviderList.getIndex(ProviderList.java:263)
> at sun.security.jca.ProviderList.getProviderConfig(ProviderList.java:247)
> at sun.security.jca.ProviderList.getProvider(ProviderList.java:253)
> at java.security.Security.getProvider(Security.java:472)
> at javax.crypto.Cipher.getInstance(Cipher.java:587)
> at test.CipherTest.main(CipherTest.java:10)
>
> I'm looking into this right now, but if anyone has any tips on how to debug
> further let me know.
>
> Thanks,
> Sean
More information about the jigsaw-dev
mailing list