5 Replies Latest reply on Jul 10, 2013 4:20 AM by jaikiran

    Module classloading problems with jboss-deployment-structure.xml in .ear file

    daniel.webelsiep

      Hi,

       

      we are migrating from JBoss 6.1.1 to JBoss EAP 6.1.0 final. During integration of Activiti process engine which is using spring framework we got some problems with the module classloading.

       

      Our used third party libs are placed in a separate module named 'cursor'. For spring integration we create another module 'org.springframework' to fix XML schema validation, as suggested in other forum threads.

       

      If we deploy the CARMEN-ejb.jar directly with the same jboss-deployment-structure.xml in META-INF folder, everything works fine. If we package the .jar file to an ear, 'cursor' module is not found any more. jboss-deployment-structure.xml seems to be found because of errors durning deployment if file is not valid.

       

      For now we placed the activiti libs into the ear/lib folder and add dependencies to 'cursor' module in MANIFEST.MF, because we have to load the META-INF directory from spring framework libs for XML schema validation. This is not working with MANIFEST.MF.

       

      Any suggestions?

       

       

      The ear structure looks like:

      ------------------------------------------

      META-INF/

      CARMEN-ejb.jar

      META-INF/application.xml

      META-INF/MANIFEST.MF

      META-INF/jboss-deployment-structure.xml

      lib/

      lib/cursor-csta-api-SNAPSHOT.jar

      lib/cursor-gui-SNAPSHOT.jar

      lib/cursor-mobile-api-SNAPSHOT.jar

      lib/cursor-office-integration-SNAPSHOT.jar

      lib/cursor-util-SNAPSHOT.jar

      csta.war

      invocation.war

      mobilecrm.war

      smartphone.war

      test.war

      --------------------------------------------

       

      jboss-deployment-strcture.xml

      -----------------------------------------

      <jboss-deployment-structure>

        <deployment>

          <dependencies>

            <module name="cursor" />

            <module name="custom" />

            <module name="cursor.spring">

              <imports>

                <include path="META-INF**"/>

                <include path="org**"/>

              </imports>

            </module>

            <module name="org.picketbox"/>

            <module name="org.jboss.netty"/>           

            <module name="org.jboss.as.clustering.infinispan"/>

            <module name="org.jboss.as.clustering.jgroups"/>

          </dependencies>

        </deployment>

      </jboss-deployment-structure>

      -----------------------------------------

        • 1. Re: Module classloading problems with jboss-deployment-structure.xml in .ear file
          jaikiran

          Daniel, welcome to the forums!

           

          Please post the entire exception stacktrace that you are running into, when you use that jboss-deployment-structure.xml.

          • 2. Re: Module classloading problems with jboss-deployment-structure.xml in .ear file
            daniel.webelsiep

            Here is the stacktrace. The JDOMException is imported by two of our session beans.

             

            08:50:58,631 DEBUG [org.jboss.modules] Module cursor:main defined by local module loader @3fda8085 (finder: local module finder @222bbc83 (roots: D:\Java\HEAD\jboss-eap-6.1.0\modules,D:\Java\HEAD\jboss-eap-6.1.0\modules\system\layers\base))

            08:50:58,635 DEBUG [org.jboss.modules] Module custom:main defined by local module loader @3fda8085 (finder: local module finder @222bbc83 (roots: D:\Java\HEAD\jboss-eap-6.1.0\modules,D:\Java\HEAD\jboss-eap-6.1.0\modules\system\layers\base))

            08:50:58,637 DEBUG [org.jboss.modules] Module org.springframework:main defined by local module loader @3fda8085 (finder: local module finder @222bbc83 (roots: D:\Java\HEAD\jboss-eap-6.1.0\modules,D:\Java\HEAD\jboss-eap-6.1.0\modules\system\layers\base))

            08:50:58,645 WARN  [org.jboss.as.dependency.private] JBAS018567: Deployment "deployment.CARMEN.ear" is using a private module ("org.jboss.netty:main") which may be changed or removed in future versions without notice.

            08:50:58,646 WARN  [org.jboss.as.dependency.private] JBAS018567: Deployment "deployment.CARMEN.ear" is using a private module ("org.jboss.netty:main") which may be changed or removed in future versions without notice.

            08:50:58,646 WARN  [org.jboss.as.dependency.private] JBAS018567: Deployment "deployment.CARMEN.ear" is using a private module ("org.jboss.as.clustering.infinispan:main") which may be changed or removed in future versions without notice.

            08:50:58,647 WARN  [org.jboss.as.dependency.private] JBAS018567: Deployment "deployment.CARMEN.ear" is using a private module ("org.jboss.as.clustering.infinispan:main") which may be changed or removed in future versions without notice.

            08:50:58,647 WARN  [org.jboss.as.dependency.private] JBAS018567: Deployment "deployment.CARMEN.ear" is using a private module ("org.jboss.as.clustering.jgroups:main") which may be changed or removed in future versions without notice.

            08:50:58,648 WARN  [org.jboss.as.dependency.private] JBAS018567: Deployment "deployment.CARMEN.ear" is using a private module ("org.jboss.as.clustering.jgroups:main") which may be changed or removed in future versions without notice.

            08:50:58,761 ERROR [org.jboss.msc.service.fail] MSC000001: Failed to start service jboss.deployment.subunit."CARMEN.ear"."CARMEN-ejb.jar".POST_MODULE: org.jboss.msc.service.StartException in service jboss.deployment.subunit."CARMEN.ear"."CARMEN-ejb.jar".P

            OST_MODULE: JBAS018733: Failed to process phase POST_MODULE of subdeployment "CARMEN-ejb.jar" of deployment "CARMEN.ear"

                    at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:127) [jboss-as-server-7.2.0.Final-redhat-8.jar:7.2.0.Final-redhat-8]

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

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

                    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) [rt.jar:1.7.0_25]

                    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) [rt.jar:1.7.0_25]

                    at java.lang.Thread.run(Thread.java:724) [rt.jar:1.7.0_25]

            Caused by: java.lang.RuntimeException: JBAS018757: Error getting reflective information for class de.cursor.jevi.server.system.updatemanagement.UpdateManagementBean with ClassLoader ModuleClassLoader for Module "deployment.CARMEN.ear.CARMEN-ejb.jar:main"

            from Service Module Loader

                    at org.jboss.as.server.deployment.reflect.DeploymentReflectionIndex.getClassIndex(DeploymentReflectionIndex.java:72) [jboss-as-server-7.2.0.Final-redhat-8.jar:7.2.0.Final-redhat-8]

                    at org.jboss.as.ee.metadata.MethodAnnotationAggregator.runtimeAnnotationInformation(MethodAnnotationAggregator.java:58)

                    at org.jboss.as.ee.component.deployers.InterceptorAnnotationProcessor.handleAnnotations(InterceptorAnnotationProcessor.java:107)

                    at org.jboss.as.ee.component.deployers.InterceptorAnnotationProcessor.processComponentConfig(InterceptorAnnotationProcessor.java:92)

                    at org.jboss.as.ee.component.deployers.InterceptorAnnotationProcessor.deploy(InterceptorAnnotationProcessor.java:77)

                    at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:120) [jboss-as-server-7.2.0.Final-redhat-8.jar:7.2.0.Final-redhat-8]

                    ... 5 more

            Caused by: java.lang.NoClassDefFoundError: org/jdom/JDOMException

                    at java.lang.Class.getDeclaredFields0(Native Method) [rt.jar:1.7.0_25]

                    at java.lang.Class.privateGetDeclaredFields(Class.java:2387) [rt.jar:1.7.0_25]

                    at java.lang.Class.getDeclaredFields(Class.java:1796) [rt.jar:1.7.0_25]

                    at org.jboss.as.server.deployment.reflect.ClassReflectionIndex.<init>(ClassReflectionIndex.java:57) [jboss-as-server-7.2.0.Final-redhat-8.jar:7.2.0.Final-redhat-8]

                    at org.jboss.as.server.deployment.reflect.DeploymentReflectionIndex.getClassIndex(DeploymentReflectionIndex.java:68) [jboss-as-server-7.2.0.Final-redhat-8.jar:7.2.0.Final-redhat-8]

                    ... 10 more

            Caused by: java.lang.ClassNotFoundException: org.jdom.JDOMException from [Module "deployment.CARMEN.ear.CARMEN-ejb.jar:main" from Service Module Loader]

                    at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:196) [jboss-modules.jar:1.2.0.Final-redhat-1]

                    at org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked(ConcurrentClassLoader.java:444) [jboss-modules.jar:1.2.0.Final-redhat-1]

                    at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:432) [jboss-modules.jar:1.2.0.Final-redhat-1]

                    at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:374) [jboss-modules.jar:1.2.0.Final-redhat-1]

                    at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:119) [jboss-modules.jar:1.2.0.Final-redhat-1]

                    ... 15 more

             

            The jdom-1.1.jar is located in the 'cursor' module. I alos tried to import internal org.jdom module from jboss. The same error occurs.

             

            I post an old version of jboss-deployment.structure.xml. The correct one looks like:

             

            <jboss-deployment-structure>

              <deployment>

                <dependencies>

                  <module name="cursor" />

                  <module name="custom" />

                  <module name="org.springframework">

                    <imports>

                      <include path="META-INF**"/>

                      <include path="org**"/>

                    </imports>

                  </module>

                  <module name="org.picketbox"/>

                  <module name="org.jboss.netty"/>           

                  <module name="org.jboss.as.clustering.infinispan"/>

                  <module name="org.jboss.as.clustering.jgroups"/>

                </dependencies>

              </deployment>

            </jboss-deployment-structure>

             

            The module.xml for 'cursor' module. With MANIFEST.MF it works fine. So we don't think the problem is in the module definition. We can also solve the problem, when we define the 'cursor' module as global module in standalone.xml, but when we running in springframe problems again. See https://community.jboss.org/thread/222322.

             

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

            <module xmlns="urn:jboss:module:1.1" name="cursor">

                      <resources>

                                <resource-root path="XmlSchema-1.4.7.jar"/>

                                <resource-root path="asm-3.3.jar"/>

                                <resource-root path="aspose.lic-20120620.jar"/>

                                <resource-root path="aspose.words-13.5.0.jar"/>

                                <resource-root path="autocomplete-1.5.0-cursor.jar"/>

                                <resource-root path="barcode4j-2.0.jar"/>

                                <resource-root path="batik-all-1.7.jar"/>

                                <resource-root path="bcmail-jdk16-1.46.jar"/>

                                <resource-root path="bcprov-jdk16-1.46.jar"/>

                                <resource-root path="bsh-2.0b4.jar"/>

                                <resource-root path="commons-beanutils-1.8.3.jar"/>

                                <resource-root path="commons-beanutils-bean-collections-1.8.3.jar"/>

                                <resource-root path="commons-beanutils-core-1.8.3.jar"/>

                                <resource-root path="commons-codec-1.5.jar"/>

                                <resource-root path="commons-collections-3.2.jar"/>

                                <resource-root path="commons-compress-1.0.jar"/>

                                <resource-root path="commons-digester-1.8.jar"/>

                                <resource-root path="commons-email-1.2.jar"/>

                                <resource-root path="commons-fileupload-1.2.1.jar"/>

                                <resource-root path="commons-httpclient-3.1.jar"/>

                                <resource-root path="commons-io-1.4.jar"/>

                                <resource-root path="commons-javaflow-20060411.jar"/>

                                <resource-root path="commons-jxpath-1.2.jar"/>

                                <resource-root path="commons-lang-2.6.jar"/>

                                <resource-root path="commons-logging-1.1.1.jar"/>

                                <resource-root path="commons-pool-1.6.jar"/>

                                <resource-root path="commons-validator-1.3.1.jar"/>

                                <resource-root path="cursor-cdo-1.0.jar"/>

                                <resource-root path="cursor-cluster-SNAPSHOT.jar"/>

                                <resource-root path="cursor-ews-api-1.1.4.jar"/>

                                <resource-root path="cursor-jrcustomizer-SNAPSHOT.jar"/>

                                <resource-root path="cursor-login-SNAPSHOT.jar"/>

                                <resource-root path="cursor-lotus-notes-1.0.jar"/>

                                <resource-root path="cursor-msoffice-1.0.jar"/>

                                <resource-root path="cursor-osmax-1.0.jar"/>

                                <resource-root path="cxf-bundle-2.7.5.jar"/>

                                <resource-root path="dom4j-1.6.1.jar"/>

                                <resource-root path="ecj-3.7.2.jar"/>

                                <resource-root path="fdsapi-1.2.jar"/>

                                <resource-root path="fontbox-1.1.0.jar"/>

                                <resource-root path="groovy-all-2.1.1.jar"/>

                                <resource-root path="groovyws-0.5.2.jar"/>

                                <resource-root path="gson-1.7.1.jar"/>

                                <resource-root path="hamcrest-core-1.1.jar"/>

                                <resource-root path="html-editor-light-1.0.jar"/>

                                <resource-root path="httpclient-4.2.1.jar"/>

                                <resource-root path="httpcore-4.2.1.jar"/>

                                <resource-root path="itext-2.1.7.jar"/>

                                <resource-root path="izmcomjni-1.5.2.1.jar"/>

                                <resource-root path="jamon-2.7.jar"/>

                                <resource-root path="jasperreports-4.5.1.jar"/>

                                <resource-root path="javamail-crypto-060622.jar"/>

                                <resource-root path="javamail-crypto-bouncycastle-smime-060622.jar"/>

                                <resource-root path="jboss-el-2.0.1.GA.jar"/>

                                <resource-root path="jcifs-1.3.15.jar"/>

                                <resource-root path="jcommon-1.0.16.jar"/>

                                <resource-root path="jdom-1.1.jar"/>

                                <resource-root path="jempbox-1.1.0.jar"/>

                                <resource-root path="jericho-html-3.1.jar"/>

                                <resource-root path="jfreechart-1.0.13.jar"/>

                                <resource-root path="jgroups-3.2.7.Final-redhat-1.jar"/>

                                <resource-root path="joda-time-2.1.jar"/>

                                <resource-root path="jsr311-api-1.1.jar"/>

                                <resource-root path="jtapi-1.4.jar"/>

                                <resource-root path="jtidy-r938.jar"/>

                                <resource-root path="junit-4.8.jar"/>

                                <resource-root path="lucene-analyzers-3.2.0.jar"/>

                                <resource-root path="lucene-core-3.2.0.jar"/>

                                <resource-root path="lucene-highlighter-3.2.0.jar"/>

                                <resource-root path="lucene-memory-3.2.0.jar"/>

                                <resource-root path="lucene-queryparser-3.2.0.jar"/>

                                <resource-root path="mail-1.4.4.jar"/>

                                <resource-root path="metadata-extractor-2.4.0-beta-1.jar"/>

                                <resource-root path="mockito-core-1.7.jar"/>

                                <resource-root path="neethi-2.0.4.jar"/>

                                <resource-root path="objenesis-1.0.jar"/>

                                <resource-root path="oro-2.0.8.jar"/>

                                <resource-root path="pdfbox-1.1.0.jar"/>

                                <resource-root path="poi-3.6.jar"/>

                                <resource-root path="poi-ooxml-3.6.jar"/>

                                <resource-root path="poi-ooxml-schemas-3.6.jar"/>

                                <resource-root path="poi-scratchpad-3.6.jar"/>

                                <resource-root path="rome-1.0.jar"/>

                                <resource-root path="rowset-1.0.jar"/>

                                <resource-root path="rsyntaxtextarea-1.5.0.jar"/>

                                <resource-root path="saxpath-1.0-FCS.jar"/>

                                <resource-root path="stax-ex-1.0.1.jar"/>

                                <resource-root path="tagsoup-1.2.jar"/>

                                <resource-root path="tika-core-0.7.jar"/>

                                <resource-root path="tika-parsers-0.7.jar"/>

                                <resource-root path="tm-extractors-1.0.jar"/>

                                <resource-root path="truezip-6.8.4.jar"/>

                                <resource-root path="velocity-1.6.4.jar"/>

                                <resource-root path="wsdl4j-1.6.2.jar"/>

                                <resource-root path="wss4j-1.5.8.jar"/>

                                <resource-root path="xercesImpl-2.9.1.jar"/>

                                <resource-root path="xml-apis-ext-1.3.04.jar"/>

                                <resource-root path="xml-resolver-1.2.jar"/>

                                <resource-root path="xmlbeans-2.3.0.jar"/>

                                <resource-root path="xmlsec-1.4.3.jar"/>

                                <resource-root path="xstream-1.4.4.jar"/>

                                <resource-root path="activation-1.1.1.jar"/>

                                <resource-root path="activiti-bpmn-converter-5.13.jar"/>

                                <resource-root path="activiti-bpmn-model-5.13.jar"/>

                                <resource-root path="activiti-engine-5.13.jar"/>

                                <resource-root path="java-uuid-generator-3.1.2.jar"/>

                                <resource-root path="mybatis-3.1.1.jar"/>

                      </resources>

                      <dependencies>

                                <module name="javax.api"/>

                                <module name="javax.servlet.api"/>

                                <module name="org.picketbox"/>

                                <module name="org.jboss.logging"/>

                                <module name="org.jboss.log4j.logmanager"/>

                                <module name="org.apache.xalan"/>

                                <module name="org.springframework"/>

                      </dependencies>

            </module>

            • 3. Re: Module classloading problems with jboss-deployment-structure.xml in .ear file
              jaikiran

              I don't see the new jboss-deployment-structure.xml in your post. But anyway, it looks like you are adding that dependency to the top level ear deployment. You'll have to add it to each of the sub deployments (or the relevant subdeployment) using the subdeployment element. Take a look at the xsd or even this documentation for an example https://docs.jboss.org/author/display/AS72/Class+Loading+in+AS7

              1 of 1 people found this helpful
              • 4. Re: Module classloading problems with jboss-deployment-structure.xml in .ear file
                daniel.webelsiep

                Yes. This was the problem. Thanks for help.

                 

                One strange thing I found during testing. Then I remove the module dependencies from deployment part and only leave the sub-deployment dependencies the deployment of the ear file works. But during runtime session beans cannot load classes from 'cursor' module. I have to add the dependencies in deployment part also to fix the runtime error.

                 

                The correct jboss-deployment-structure.xml have to look like:

                 

                -------------------------------------------

                <jboss-deployment-structure>

                  <deployment>

                    <dependencies>

                      <module name="cursor" />

                      <module name="custom" />

                      <module name="org.springframework">

                        <imports>

                          <include path="META-INF**"/>

                          <include path="org**"/>

                        </imports>

                      </module>

                      <module name="org.picketbox"/>

                      <module name="org.jboss.netty"/>           

                      <module name="org.jboss.as.clustering.infinispan"/>

                      <module name="org.jboss.as.clustering.jgroups"/>

                      <module name="org.apache.commons.logging"/>

                      <module name="org.slf4j"/>

                    </dependencies>

                  </deployment>

                  <sub-deployment name="CARMEN-ejb.jar">

                    <dependencies>

                      <module name="cursor" />

                      <module name="custom" />

                      <module name="org.springframework">

                        <imports>

                          <include path="META-INF**"/>

                          <include path="org**"/>

                        </imports>

                      </module>

                      <module name="org.picketbox"/>

                      <module name="org.jboss.netty"/>           

                      <module name="org.jboss.as.clustering.infinispan"/>

                      <module name="org.jboss.as.clustering.jgroups"/>

                      <module name="org.apache.commons.logging"/>

                      <module name="org.slf4j"/>           

                    </dependencies>

                    <local-last value="true" />

                  </sub-deployment> 

                </jboss-deployment-structure>

                -----------------------------------------

                • 5. Re: Module classloading problems with jboss-deployment-structure.xml in .ear file
                  jaikiran

                  Daniel Webelsiep wrote:

                   

                   

                   

                  One strange thing I found during testing. Then I remove the module dependencies from deployment part and only leave the sub-deployment dependencies the deployment of the ear file works. But during runtime session beans cannot load classes from 'cursor' module. I have to add the dependencies in deployment part also to fix the runtime error.

                   

                  That's the correct way to do it. At runtime, I believe some of your ear deployment classes (like the ones in .ear/lib/foo.jar) perhaps need to access the classes from that module, which is why you'll have to add the dependency to the top level deployment too.