JBoss 7.1.1 Crypto Library Not Found Issue
When I was migrating an application from JBoss 4 (4.2.3) to JBoss 7 (7.1.1), I encountered an issue:java.lang.ClassNotFoundException: com.sun.crypto.provider.SunJCE
JBoss 7.1.1 Crypto Library Not Found Solution
After some search on the Internet, I managed to find a solution. Steps:- Create a directory modules/sun/jdk/main;
- Under 'main', create a file module.xml;
- Add the following content to the file.
<module xmlns="urn:jboss:module:1.1" name="sun.jdk"> <resources> <resource-root path="service-loader-resources"/> </resources> <dependencies> <system export="true"> <paths> <path name="com/sun/crypto/provider"/> <path name="com/sun/script/javascript"/> <path name="com/sun/jndi/dns"/> <path name="com/sun/jndi/ldap"/> <path name="com/sun/jndi/url"/> <path name="com/sun/jndi/url/dns"/> <path name="com/sun/security/auth"/> <path name="com/sun/security/auth/login"/> <path name="com/sun/security/auth/module"/> <path name="sun/misc"/> <path name="sun/io"/> <path name="sun/nio"/> <path name="sun/nio/ch"/> <path name="sun/security"/> <path name="sun/security/krb5"/> <path name="sun/util"/> <path name="sun/util/calendar"/> <path name="sun/util/locale"/> <path name="sun/security/provider"/> <path name="META-INF/services"/> </paths> <exports> <include-set> <path name="META-INF/services"/> </include-set> </exports> </system> </dependencies>
The tricky part is path name="com/sun/crypto/provider"/>, which instructs JBoss to load necessary crypto lib for you.