3 Replies Latest reply on Mar 29, 2012 5:01 PM by Stuart Douglas

    classloading issues deploying MDB (that uses resource-adapter)

    jleinawe Newbie

      I deploy a resource-adapter for JMS.   The rar file includes a jar file containing the resource-adapter implementation and JMS client libraries for the JMS provider along with the JNDI classes needed to connection to that JMS Provider.   (the JMS provider isn't JBoss).

       

      I can deploy the rar file successfully.

       

      I try to deploy a Message Driven Bean and get the following error

       

      Caused by: java.lang.RuntimeException: javax.resource.NotSupportedException: failure looking up resource provider factory for GenericXAConnectionFactory [XA Unified]-OracleJMSConnector.GenericXAConnectionFactory.adc2100774.us.oracle.com.-38dcaf4a:1365a5ba0ca:-8000.5 []: javax.resource.ResourceException: Error creating naming context instance: JBAS011843: Failed instantiate InitialContextFactory oracle.j2ee.jms.v1.NamingFactory from classloader ModuleClassLoader for Module "org.jboss.as.ee:main" from local module loader @141bcd49 (roots: /scratch/jleinawe/jboss71/new/jboss-as-7.1.1.Final-SNAPSHOT/modules)

       

       

      So I go to jboss-as-7.1.1.Final-SNAPSHOT/modules/org/jboss/as/ee/main  and in module.xml:

      I add my client libaries under <resources/>

          <resources>

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

               ...

          </resources>

      and I copy myClientLibrary.jar to jboss-as-7.1.1.Final-SNAPSHOT/modules/org/jboss/as/ee/main

       

       

      I try to deploy the MDB again, this time it complains about javax.jms.JMSException

       

      Caused by: javax.naming.CommunicationException: Unable to establish connection with server.  There may be a network issue, the server may be down, or the connection address may be incorrect. (build: 02af) [Root exception is java.lang.NoClassDefFoundError: javax/jms/JMSException]

       

      I go back to jboss-as-7.1.1.Final-SNAPSHOT/modules/org/jboss/as/ee/main/module.xml

      and add this dependency

          <dependencies>

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

               ...

       

      I can now get my MDB to work.

       

      In other application servers, I can deploy this rar file and the mdb without having to do anything within the app-server to overcome class loading issues.   They manage to find the required classes in the rar file and don't need to be tweaked so the app-server can find the JMS interfaces.

       

      I deploy the rar, then the ear by dropping them in the standalone/deployments directory.   I am using JBoss AS7.   

       

      What do I have to differently to get classloading to work with RARs and MDBs with JBoss 7?   While the steps above worked for me, they feel like a hack.

        • 1. Re: classloading issues deploying MDB (that uses resource-adapter)
          Stuart Douglas Master

          It looks like the TCCL is not set correctly. Can you post the full stack trace when you get the first exception?

          • 2. Re: classloading issues deploying MDB (that uses resource-adapter)
            jleinawe Newbie

            Here is the server output, including the stack trace.

             

            Start JBoss (standalone)

            drop deploy resource adapter "wljmsra.rar"

            drop deploy the ear file containing a servlet/mdb.

             

             

             

             

            =========================================================================

             

             

              JBoss Bootstrap Environment

             

             

              JBOSS_HOME: /scratch/jleinawe/jboss71/new/jboss-as-7.1.1.Final-SNAPSHOT

             

             

              JAVA: /scratch/jleinawe/p4/w/dev/src1212/build/x86_64/jdk7_04/jdk1.7.0_04/bin/java

             

             

              JAVA_OPTS:  -server -XX:+UseCompressedOops -XX:+TieredCompilation -Xms64m -Xmx512m -XX:MaxPermSize=256m -Djava.net.preferIPv4Stack=true -Dorg.jboss.resolver.warning=true -Dsun.rmi.dgc.client.gcInterval=3600000 -Dsun.rmi.dgc.server.gcInterval=3600000 -Djboss.modules.system.pkgs=org.jboss.byteman -Djava.awt.headless=true -Djboss.server.default.config=standalone.xml

             

             

            =========================================================================

             

             

            09:28:06,391 INFO  [org.jboss.modules] JBoss Modules version 1.1.1.GA

            09:28:06,596 INFO  [org.jboss.msc] JBoss MSC version 1.0.2.GA

            09:28:06,652 INFO  [org.jboss.as] JBAS015899: JBoss AS 7.1.1.Final-SNAPSHOT "Thunder" starting

            09:28:07,925 INFO  [org.jboss.as.server] JBAS015888: Creating http management service using socket-binding (management-http)

            09:28:07,958 INFO  [org.jboss.as.configadmin] JBAS016200: Activating ConfigAdmin Subsystem

            09:28:07,995 INFO  [org.jboss.as.connector.subsystems.datasources] JBAS010403: Deploying JDBC-compliant driver class org.h2.Driver (version 1.3)

            09:28:08,031 INFO  [org.jboss.as.clustering.infinispan] JBAS010280: Activating Infinispan subsystem.

            09:28:08,050 INFO  [org.jboss.as.naming] JBAS011800: Activating Naming Subsystem

            09:28:08,143 INFO  [org.jboss.as.logging] JBAS011502: Removing bootstrap log handlers

            09:28:08,458 INFO  [org.jboss.as.security] (MSC service thread 1-3) JBAS013100: Current PicketBox version=4.0.7.Final

            09:28:08,493 INFO  [org.jboss.as.naming] (MSC service thread 1-2) JBAS011802: Starting Naming Service

            09:28:08,552 INFO  [org.jboss.as.mail.extension] (MSC service thread 1-2) JBAS015400: Bound mail session [java:jboss/mail/Default]

            09:28:08,687 INFO  [org.jboss.ws.common.management.AbstractServerConfig] (MSC service thread 1-4) JBoss Web Services - Stack CXF Server 4.0.2.GA

            09:28:09,042 INFO  [org.apache.coyote.http11.Http11Protocol] (MSC service thread 1-1) Starting Coyote HTTP/1.1 on http--127.0.0.1-8080

            09:28:09,248 INFO  [org.jboss.as.server.deployment.scanner] (MSC service thread 1-1) JBAS015012: Started FileSystemDeploymentService for directory /scratch/jleinawe/jboss71/new/jboss-as-7.1.1.Final-SNAPSHOT/standalone/deployments

            09:28:09,253 INFO  [org.jboss.as.remoting] (MSC service thread 1-2) JBAS017100: Listening on /127.0.0.1:9999

            09:28:09,262 INFO  [org.jboss.as.remoting] (MSC service thread 1-1) JBAS017100: Listening on /127.0.0.1:4447

            09:28:09,417 INFO  [org.jboss.as.connector.subsystems.datasources] (MSC service thread 1-3) JBAS010400: Bound data source [java:jboss/datasources/ExampleDS]

            09:28:09,439 INFO  [org.jboss.as] (Controller Boot Thread) JBAS015951: Admin console listening on http://127.0.0.1:9990

            09:28:09,442 INFO  [org.jboss.as] (Controller Boot Thread) JBAS015874: JBoss AS 7.1.1.Final-SNAPSHOT "Thunder" started in 3357ms - Started 148 of 222 services (73 services are passive or on-demand)

            09:28:24,325 INFO  [org.jboss.as.server.deployment] (MSC service thread 1-4) JBAS015876: Starting deployment of "wljmsra.rar"

            09:28:25,108 WARN  [org.jboss.as.server.deployment] (MSC service thread 1-1) Class Path entry tibjms.jar in "/content/wljmsra.rar"  does not point to a valid jar for a Class-Path reference.

            09:28:25,109 WARN  [org.jboss.as.server.deployment] (MSC service thread 1-1) Class Path entry weblogic.jms.ra.jar in "/content/wljmsra.rar"  does not point to a valid jar for a Class-Path reference.

            09:28:25,110 WARN  [org.jboss.as.server.deployment] (MSC service thread 1-1) Class Path entry wlthint3client.jar in "/content/wljmsra.rar"  does not point to a valid jar for a Class-Path reference.

            09:28:25,230 WARN  [org.jboss.as.dependency.private] (MSC service thread 1-4) JBAS018567: Deployment "deployment.wljmsra.rar" is using a private module ("org.jboss.as.jmx:main") which may be changed or removed in future versions without notice.

            09:28:25,395 INFO  [org.jboss.as.deployment.connector] (MSC service thread 1-1) JBAS010406: Registered connection factory java:jboss/wljmsra/xacf

            09:28:25,397 INFO  [org.jboss.as.deployment.connector] (MSC service thread 1-4) JBAS010406: Registered connection factory java:jboss/wljmsra/cf

            09:28:25,402 INFO  [org.jboss.as.deployment.connector] (MSC service thread 1-1) JBAS010405: Registered admin object at java:jboss/wljmsra/queue

            09:28:25,404 INFO  [org.jboss.as.deployment.connector] (MSC service thread 1-1) JBAS010405: Registered admin object at java:jboss/wljmsra/queue2

            09:28:25,405 INFO  [org.jboss.as.deployment.connector] (MSC service thread 1-1) JBAS010405: Registered admin object at java:jboss/wljmsra/context

            09:28:25,437 INFO  [org.jboss.as.connector.deployers.RaXmlDeployer] (MSC service thread 1-1) IJ020002: Deployed: file:/scratch/jleinawe/jboss71/new/jboss-as-7.1.1.Final-SNAPSHOT/standalone/tmp/vfs/temp4265f15ab5275ffb/wljmsra.rar-b45d1457031443f5/contents/

            09:28:25,463 INFO  [org.jboss.as.connector.deployers.RaXmlDeployer] (MSC service thread 1-4) IJ020002: Deployed: file:/scratch/jleinawe/jboss71/new/jboss-as-7.1.1.Final-SNAPSHOT/standalone/tmp/vfs/temp4265f15ab5275ffb/wljmsra.rar-b45d1457031443f5/contents/

            09:28:25,468 INFO  [org.jboss.as.deployment.connector] (MSC service thread 1-1) JBAS010401: Bound JCA ConnectionFactory [java:jboss/wljmsra/xacf]

            09:28:25,473 INFO  [org.jboss.as.deployment.connector] (MSC service thread 1-1) JBAS010401: Bound JCA ConnectionFactory [java:jboss/wljmsra/cf]

            09:28:25,475 INFO  [org.jboss.as.deployment.connector] (MSC service thread 1-2) JBAS010401: Bound JCA AdminObject [java:jboss/wljmsra/context]

            09:28:25,476 INFO  [org.jboss.as.deployment.connector] (MSC service thread 1-3) JBAS010401: Bound JCA AdminObject [java:jboss/wljmsra/queue]

            09:28:25,477 INFO  [org.jboss.as.deployment.connector] (MSC service thread 1-1) JBAS010401: Bound JCA AdminObject [java:jboss/wljmsra/queue2]

            09:28:25,552 INFO  [org.jboss.as.server] (DeploymentScanner-threads - 2) JBAS018559: Deployed "wljmsra.rar"

            09:28:50,589 INFO  [org.jboss.as.server.deployment] (MSC service thread 1-3) JBAS015876: Starting deployment of "test.ear"

            09:28:50,605 INFO  [org.jboss.as.server.deployment] (MSC service thread 1-4) JBAS015876: Starting deployment of "test-web.war"

            09:28:50,605 INFO  [org.jboss.as.server.deployment] (MSC service thread 1-1) JBAS015876: Starting deployment of "test-ejb.jar"

            09:28:51,057 INFO  [org.jboss.as.ejb3] (MSC service thread 1-1) JBAS014142: Started message driven bean 'MyXaMdb' with 'wljmsra' resource adapter

            09:28:51,107 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-4) MSC00001: Failed to start service jboss.deployment.subunit."test.ear"."test-ejb.jar".component.MyXaMdb.START: org.jboss.msc.service.StartException in service jboss.deployment.subunit."test.ear"."test-ejb.jar".component.MyXaMdb.START: Failed to start service

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

                      at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110) [rt.jar:1.7.0_04-ea]

                      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603) [rt.jar:1.7.0_04-ea]

                      at java.lang.Thread.run(Thread.java:722) [rt.jar:1.7.0_04-ea]

            Caused by: java.lang.RuntimeException: javax.resource.NotSupportedException: failure looking up resource provider factory for GenericXAConnectionFactory [XA Unified]-OracleJMSConnector.GenericXAConnectionFactory.adc2100774.us.oracle.com.-10a0e6c:1365f495d6c:-8000.5 []: javax.resource.ResourceException: Error creating naming context instance: JBAS011843: Failed instantiate InitialContextFactory oracle.j2ee.jms.v1.NamingFactory from classloader ModuleClassLoader for Module "org.jboss.as.ee:main" from local module loader @141bcd49 (roots: /scratch/jleinawe/jboss71/new/jboss-as-7.1.1.Final-SNAPSHOT/modules)

                      at org.jboss.as.ejb3.component.messagedriven.MessageDrivenComponent.start(MessageDrivenComponent.java:171)

                      at org.jboss.as.ee.component.ComponentStartService.start(ComponentStartService.java:44)

                      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

            Caused by: javax.resource.NotSupportedException: failure looking up resource provider factory for GenericXAConnectionFactory [XA Unified]-OracleJMSConnector.GenericXAConnectionFactory.adc2100774.us.oracle.com.-10a0e6c:1365f495d6c:-8000.5 []: javax.resource.ResourceException: Error creating naming context instance: JBAS011843: Failed instantiate InitialContextFactory oracle.j2ee.jms.v1.NamingFactory from classloader ModuleClassLoader for Module "org.jboss.as.ee:main" from local module loader @141bcd49 (roots: /scratch/jleinawe/jboss71/new/jboss-as-7.1.1.Final-SNAPSHOT/modules)

                      at weblogic.jms.ra.RAUtils.make(RAUtils.java:532)

                      at weblogic.jms.ra.RAUtils.toNotSupportedException(RAUtils.java:601)

                      at weblogic.jms.ra.EndpointConsumer.<init>(EndpointConsumer.java:109)

                      at weblogic.jms.ra.ResourceAdapterImpl.endpointActivation(ResourceAdapterImpl.java:370)

                      at org.jboss.jca.core.rar.EndpointImpl.activate(EndpointImpl.java:157)

                      at org.jboss.as.ejb3.component.messagedriven.MessageDrivenComponent.start(MessageDrivenComponent.java:169)

                      ... 6 more

            Caused by: javax.resource.ResourceException: Error creating naming context instance: JBAS011843: Failed instantiate InitialContextFactory oracle.j2ee.jms.v1.NamingFactory from classloader ModuleClassLoader for Module "org.jboss.as.ee:main" from local module loader @141bcd49 (roots: /scratch/jleinawe/jboss71/new/jboss-as-7.1.1.Final-SNAPSHOT/modules)

                      at weblogic.jms.ra.rp.JndiResourceProvider.getResource(JndiResourceProvider.java:84)

                      at weblogic.jms.ra.RAUtils.lookupUsingConnectorScheme(RAUtils.java:311)

                      at weblogic.jms.ra.RAUtils.lookupUsingRpResourceLocation(RAUtils.java:251)

                      at weblogic.jms.ra.ManagedFactoryBase.getFactory(ManagedFactoryBase.java:660)

                      at weblogic.jms.ra.EndpointConsumer.<init>(EndpointConsumer.java:107)

                      ... 9 more

            Caused by: javax.naming.NamingException: JBAS011843: Failed instantiate InitialContextFactory oracle.j2ee.jms.v1.NamingFactory from classloader ModuleClassLoader for Module "org.jboss.as.ee:main" from local module loader @141bcd49 (roots: /scratch/jleinawe/jboss71/new/jboss-as-7.1.1.Final-SNAPSHOT/modules)

                      at org.jboss.as.naming.InitialContextFactoryBuilder.createInitialContextFactory(InitialContextFactoryBuilder.java:64)

                      at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:681) [rt.jar:1.7.0_04-ea]

                      at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:307) [rt.jar:1.7.0_04-ea]

                      at javax.naming.InitialContext.init(InitialContext.java:242) [rt.jar:1.7.0_04-ea]

                      at javax.naming.InitialContext.<init>(InitialContext.java:216) [rt.jar:1.7.0_04-ea]

                      at weblogic.jms.ra.rp.JndiResourceProvider.getResource(JndiResourceProvider.java:81)

                      ... 13 more

             

             

            09:28:51,175 INFO  [org.jboss.web] (MSC service thread 1-2) JBAS018210: Registering web context: /test

            09:28:51,178 INFO  [org.jboss.as.server] (DeploymentScanner-threads - 2) JBAS015870: Deploy of deployment "test.ear" was rolled back with failure message {"JBAS014671: Failed services" => {"jboss.deployment.subunit.\"test.ear\".\"test-ejb.jar\".component.MyXaMdb.START" => "org.jboss.msc.service.StartException in service jboss.deployment.subunit.\"test.ear\".\"test-ejb.jar\".component.MyXaMdb.START: Failed to start service"}}

            09:28:51,180 INFO  [org.jboss.as.controller] (DeploymentScanner-threads - 2) JBAS014774: Service status report

            JBAS014777:   Services which failed to start:      service jboss.deployment.subunit."test.ear"."test-ejb.jar".component.MyXaMdb.START: org.jboss.msc.service.StartException in service jboss.deployment.subunit."test.ear"."test-ejb.jar".component.MyXaMdb.START: Failed to start service

             

             

            09:28:51,182 ERROR [org.jboss.as.server.deployment.scanner] (DeploymentScanner-threads - 1) {"JBAS014653: Composite operation failed and was rolled back. Steps that failed:" => {"Operation step-2" => {"JBAS014671: Failed services" => {"jboss.deployment.subunit.\"test.ear\".\"test-ejb.jar\".component.MyXaMdb.START" => "org.jboss.msc.service.StartException in service jboss.deployment.subunit.\"test.ear\".\"test-ejb.jar\".component.MyXaMdb.START: Failed to start service"}}}}

            09:28:51,264 INFO  [org.jboss.as.server.deployment] (MSC service thread 1-2) JBAS015877: Stopped deployment test-web.war in 79ms

            09:28:51,266 INFO  [org.jboss.as.server.deployment] (MSC service thread 1-4) JBAS015877: Stopped deployment test-ejb.jar in 80ms

            09:28:51,267 INFO  [org.jboss.as.server.deployment] (MSC service thread 1-4) JBAS015877: Stopped deployment test.ear in 83ms