3 Replies Latest reply on Dec 19, 2012 2:48 AM by Varsha Gadekar

    NoClassDefFoundError in JBoss AS7

    zhiwei li Newbie

      I got this exception:

        java.lang.NoClassDefFoundError: javax/annotation/processing/ProcessingEnvironment at java.lang.ClassLoader.defineClass1(Native Method)

       

      but it should be in jre/lib/rt.jar, and I saw  "<module name="javax.annotation.api" export="true"/>" in $JBOSS_HOME\modules\javaee\api\main\module.xml already,and after traced in  $JBOSS_HOME\modules\javax\annotation\api\main\jboss-annotations-api_1.1_spec-1.0.0.Final.jar,seems

      those classes same with rt.jar. anyone can explain me that when JBoss AS7 will load rt.jar ? and will it conflict with classes in modules?

        • 1. Re: NoClassDefFoundError in JBoss AS7
          Fabrizio Benedetti Novice

          It seems to me that Jboss modules does not load everything from rt.jar (maybe this is a result of the new classloading model).

           

          There is a modue named "sun.jdk" that depdends on module "system". Here are defined all packages jboss loads from rt.jar.

           

          I think that if you want extra packeges, such as javax/annotation/processing, you have to add them in sun/jdk/main/module.xml.

           

          Example:

          <module xmlns="urn:jboss:module:1.0" name="sun.jdk">

              <resources>

                  <!-- currently jboss modules has not way of importing services from

                  classes.jar so we duplicate them here -->

                  <resource-root path="service-loader-resources"/>

              </resources>

              <dependencies>

                  <module name="system" export="false" services="import">

                      <exports>

                          <include-set>

           

                              <!-- extra packages -->

                              <path name="javax/annotation/processing"/>

           

                              <path name="com/sun/script/javascript"/>

                              <path name="com/sun/jndi/dns"/>

                              <path name="com/sun/jndi/ldap"/>

                              <path name="com/sun/security/auth"/>

                              <path name="com/sun/security/auth/module"/>

                              <path name="sun/misc"/>

                              <path name="sun/nio"/>

                              <path name="sun/nio/ch"/>

                              <path name="sun/util"/>

                              <path name="sun/util/calendar"/>

                              <path name="META-INF/services"/>

                          </include-set>

                      </exports>

                  </module>

              </dependencies>

          </module>

           

          The reason of your error is that jboss-annotations-api_1.1_spec-1.0.0.Final.jar does not contain javax.annotation.processing.ProcessingEnvironment.

           

          Try it and let me know.

          • 2. Re: NoClassDefFoundError in JBoss AS7
            zhiwei li Newbie

            yes,it's correct.thanks very much.

            • 3. Re: NoClassDefFoundError in JBoss AS7
              Varsha Gadekar Newbie

              Hi,

               

              I am facing similar issue for Provider.java in jdk1.6.0_21\jre\lib\jsse.jar.

               

              Error - Caused by: java.lang.NoClassDefFoundError: com/sun/net/ssl/internal/ssl/Provider

               

              I have updated the module.xml in sun\jdk\main as follows

               

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

              <module xmlns="urn:jboss:module:1.1" name="sun.jdk">

                  <resources>

                      <!-- currently jboss modules has not way of importing services from

                      classes.jar so we duplicate them here -->

                      <resource-root path="service-loader-resources"/>

                  </resources>

                  <dependencies>

                       <module name="system" export="false" services="import">

                              <exports>

                              <include-set>

                              <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"/>

                  <!-- added for ssl load issue-->

                  <path name="com/sun/net/ssl"/>

                  <path name="com/sun/net/ssl/internal/ssl"/>

                  <path name="com/sun/net/ssl/internal/pkcs12"/>

                              <path name="com/sun/net/ssl/internal/www/protocol/https"/>

                              <path name="com/sun/security/cert/internal/x509"/>

                              <path name="javax/net"/>

                              <path name="javax/net/ssl"/>

                              <path name="javax/security/cert"/>

                              <path name="sun/net/www/protocol/https"/>

                              <path name="com/sun/net/ssl/internal/www/protocol/https"/>

                  <!-- end>                                                            

                                          <path name="META-INF/services"/>

                           </include-set>

                          </exports>

                      </module>

                  </dependencies>

              </module>

               

              After starting the server I am getting new exception:

              13:02:29,960 INFO  [org.jboss.modules] JBoss Modules version 1.1.1.GA

              13:02:30,117 INFO  [org.jboss.msc] JBoss MSC version 1.0.2.GA

              13:02:30,163 INFO  [org.jboss.as] JBAS015899: JBoss AS 7.1.1.Final "Brontes" starting

              13:02:30,265 WARN  [org.jboss.modules] Failed to define class org.jboss.as.security.vault.RuntimeVaultReader in Module "org.jboss.as.security:main" from local module loader @1bd7848 (roots: D:\jboss-as-7.1.1.Final\modules): org.jboss.modules.ModuleLoadError: Module system:main is not found in local module loader @1bd7848 (roots: D:\jboss-as-7.1.1.Final\modules)

                              at org.jboss.modules.ModuleLoadException.toError(ModuleLoadException.java:78) [jboss-modules.jar:1.1.1.GA]

                              at org.jboss.modules.Module.getPathsUnchecked(Module.java:1166) [jboss-modules.jar:1.1.1.GA]

              Caused by: java.util.ServiceConfigurationError: org.jboss.as.server.services.security.AbstractVaultReader: Provider org.jboss.as.security.vault.RuntimeVaultReader not found

                              at java.util.ServiceLoader.fail(ServiceLoader.java:214) [rt.jar:1.6.0_21]

                              at java.util.ServiceLoader.access$400(ServiceLoader.java:164) [rt.jar:1.6.0_21]

                              at java.util.ServiceLoader$LazyIterator.next(ServiceLoader.java:350) [rt.jar:1.6.0_21]

                              at java.util.ServiceLoader$1.next(ServiceLoader.java:421) [rt.jar:1.6.0_21]

                              at org.jboss.as.server.ApplicationServerService.service(ApplicationServerService.java:224) [jboss-as-server-7.1.1.Final.jar:7.1.1.Final]

                              at org.jboss.as.server.ApplicationServerService.start(ApplicationServerService.java:139) [jboss-as-server-7.1.1.Final.jar:7.1.1.Final]

                              at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1811) [jboss-msc-1.0.2.GA.jar:1.0.2.GA]

                              at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1746) [jboss-msc-1.0.2.GA.jar:1.0.2.GA]

                              ... 3 more

               

              Please let me know if you have any inputs.

               

              Thanks.