Monday, January 26, 2015

JBoss AS 7.1.1 - Crypto Libreary Not Found Issue When Migration from JBoss 4.2.3

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:
  1. Create a directory modules/sun/jdk/main;
  2. Under 'main', create a file module.xml;
  3. 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.



Create a Successful Online Store at Bigcommerce! Try it Free Now!

No comments:

Post a Comment