5 Replies Latest reply on Nov 14, 2011 7:43 AM by chapirous

    JBoss 7 and SunPKCS11

    chapirous

      Hello,

       

      I'm migrating an application from Tomcat 6 to JBoss AS 7.

      I'm using the same jdk, jdk1.6.0_29.

       

      I have the following problem:

      java.lang.NoClassDefFoundError: sun/security/pkcs11/SunPKCS11

         ...

         ...

      Caused by: java.lang.ClassNotFoundException: sun.security.pkcs11.SunPKCS11 from [Module "deployment.my-app.war:main" from Service Module Loader]

       

      The jar sunpkcs11.jar is in /jre/lib/ext.

       

      Apparently, JBoss does not load the jars in /jre/lib/ext.

       

      There is something to be done to load the jars in that path?

       

       

      Thanks

        • 1. Re: JBoss 7 and SunPKCS11
          alesj

          You need to depend on sun.com module -- vendor specific modules are not exposed by default to apps.

          See how to add module dependencies in AS7 docs.

          • 2. Re: JBoss 7 and SunPKCS11
            chapirous

            I can't find a module named sun.com, but there is one named sun.jdk

             

            I added a line in MANIFEST.MF:

            Dependencies: sun.jdk

             

            But the same error occurs.

             

            The xml that describes module sun.jdk has no entry for: <path name="sun/security/pkcs11"/>

             

            I added this to the set, but no sucess.

             

            Is there anything else to do?

             

            thanks for help.

            • 3. Re: JBoss 7 and SunPKCS11
              alesj

              What about if you also add it into standalone.conf, same way as byteman package is defined in there?

              • 4. Re: JBoss 7 and SunPKCS11
                alesj

                What about if you also add it into standalone.conf, same way as byteman package is defined in there?

                Since the way this works is:

                * system module scans pre-defined "default" things

                * you can extend these default things with system property (see the one against byteman pckg in standalone.conf)

                * then sun.jdk only exports parts of system packages

                * if the package wasn't included in the first place, it cannot be exported, right? :-)

                * hence add it as mentioned in the previous, now quoted, post

                • 5. Re: JBoss 7 and SunPKCS11
                  chapirous

                  Thanks, i'll try this.

                   

                  My solution was:

                  I created a module named sun.ext and put in all ext jars.

                  So i tried start the application and a new error occurred, classNotFound for:

                  sun.security.rsa.SunRsaSign. This class belongs to the core of java.

                   

                  So i changed the export attribute of sun.jdk module to true. And finally

                  worked.