5 Replies Latest reply on Oct 17, 2016 9:14 AM by brian_parker

    Jboss and Wildfly do not appear to load all of rt.jar (and other Jave jre jars)

    brian_parker

      In Jboss 7.1.1, we were getting the following error :

       

      decryption error: java.lang.NoClassDefFoundError: javax/crypto/spec/PBEParameterSpec

       

      It was getting logged very often causing the log files to grow quite large.

       

      We had added a global module by adding

       

           <global-modules>

                <module name="org.jboss.wisl" slot="main"/>

           </global-modules>

       

      to the

       

      <subsystem xmlns="urn:jboss:domain:ee:1.1">

       

      in the standalone.xml file.

       

      We had created the module.xml and copied a couople of jars into a directory called org/jboss/wisl/main. We foudn we had to copy the jce, jsee and rt  jars from the Jave jre directory into this global module directory and set the module.xml as follows:

       

      <?xml version="1.0" encoding="UTF-8"?>

      <module xmlns="urn:jboss:module:1.0" name="org.jboss.wisl">

          <resources>

              <resource-root path="RedBeans.jar"/>

        <resource-root path="asjava.jar"/>

        <resource-root path="jce.jar"/>

        <resource-root path="jsse.jar"/>

           <resource-root path="rt.jar"/>

          </resources>

          <dependencies>

              <module name="javax.api" slot="main" export="true" />

          </dependencies>

      </module>

       

      The above stopped the error.

       

      When we moved to Wildfly 9.0.1, we were also getting the above error. In Wildfly 9.0.1, we added

       

                  <global-modules>

                      <module name="org.jboss.wisl" slot="main"/>

                  </global-modules>

      to the

       

      <subsystem xmlns="urn:jboss:domain:ee:3.0">

       

      of standalone.xml . Without the jce, jsse and rt jars we were getting the "decryption error: java.lang.NoClassDefFoundError: javax/crypto/spec/PBEParameterSpec" error. We added the jars and change the module.xml as above and not we get the following errors:

       

      decryption error: java.lang.LinkageError: loader constraint violation: loader (instance of org/jboss/modules/ModuleClassLoader) previously initiated loading for a different type with name "javax/security/auth/x500/X500Principal"

      decryption error: java.lang.NoClassDefFoundError: Could not initialize class sun.security.x509.X500Name

       

      The loader constraint error is logged the one time and the sun.security.x509.X500Name error gets logged numerous time, making the logs grow quite large.

       

      Is there a better way to have Jboss/Wildfly load the Java/jre/lib jars so that the errors do not occur?

       

      is there another jar or dependency that I need to add the wisl/main/module.xml to address the 'decryption error: java.lang.NoClassDefFoundError: Could not initialize class sun.security.x509.X500Name" error in Wildfly?

        • 1. Re: Jboss and Wildfly do not appear to load all of rt.jar (and other Jave jre jars)
          mchoma

          Note, there are predefined modules javax.api and sun.jdk , which imports packages you are talking about. Maybe you should try to depend on that in your module.

          • 3. Re: Jboss and Wildfly do not appear to load all of rt.jar (and other Jave jre jars)
            brian_parker

            Thanks for the replies. I don't know if I saw the specific site Wolfgang mentions, but I saw some similar .

             

            I tried adding to the dependencies in the org/jboss/wisl/main/module.xml. The javax.api was already there and I added the sun.jdk per Martin's suggestion. It now looks like this:

             

            <module xmlns="urn:jboss:module:1.0" name="org.jboss.wisl">

                <resources>

                    <resource-root path="RedBeans.jar"/>

                    <resource-root path="asjava.jar"/>

                   <resource-root path="jce.jar"/>

                   <resource-root path="jsse.jar"/>

                   <resource-root path="rt.jar"/>

                </resources>

                <dependencies>

                    <module name="javax.api" slot="main" export="true" />

                    <module name="sun.jdk" slot="main" export="true" />

                </dependencies>

            </module>

             

            But I continue to get the "decryption error: java.lang.LinkageError: loader constraint violation: loader (instance of org/jboss/modules/ModuleClassLoader) previously initiated loading for a different type with name "javax/security/auth/x500/X500Principal"" and the "decryption error: java.lang.NoClassDefFoundError: Could not initialize class sun.security.x509.X500Name" error.

             

            In the server.log I am also now seeing the following error:

             

            Failed to define class javax.security.auth.x500.X500Principal in Module "org.jboss.wisl:main" from local module loader @707f7052 (finder: local module finder @11028347 (roots: C:\wildfly-9.0.1.Final\modules,C:\wildfly-9.0.1.Final\modules\system\layers\base)): java.lang.LinkageError: loader constraint violation: loader (instance of org/jboss/modules/ModuleClassLoader) previously initiated loading for a different type with name "javax/security/auth/x500/X500Principal"

            • 4. Re: Jboss and Wildfly do not appear to load all of rt.jar (and other Jave jre jars)
              ctomc

              Well, there are many things you could do, but including JRE jars in your module is definitely not one of them.

               

              So removing jdk jars should be step one, from there one, you just add dependencies to existing modules.

               

              <module xmlns="urn:jboss:module:1.3" name="org.jboss.wisl">

                  <resources>

                      <resource-root path="RedBeans.jar"/>

                      <resource-root path="asjava.jar"/>

                  </resources>

                  <dependencies>

                      <module name="javax.api" />

                      <module name="sun.jdk" />

                  </dependencies>

              </module>

               

              and that is it. no complicating.

              • 5. Re: Jboss and Wildfly do not appear to load all of rt.jar (and other Jave jre jars)
                brian_parker

                Hi Tomaz,

                 

                I didn't want to copy the JRE jars into my module. It was sort of a last ditch effort.

                 

                I removed them and changed the module to as above and I get the recurring error of:

                 

                RedObject decryption error: javax.crypto.IllegalBlockSizeException: Input length must be multiple of 8 when decrypting with padded cipher

                 

                Does that mean the above point to an issue with RedObject - which is part of the RedBeans.jar and is the reason for the module in the first place?