2 Replies Latest reply: Apr 2, 2012 5:46 PM by jmighion RSS

    ClassNotFoundException with MDB and resource adapter

    jmighion Newbie

      I'm trying to use the Websphere MQ resource adapter wmq.jmsra.rar with a MDB on both AS 7.1.0.Beta1 and EAP 6 beta.

      On both I get the same exception NoClassDefFoundError at runtime after putting a message on the queue that the MDB is listening on.

      Both the connection factory and the admin object are registered and bound, but following that I also get an error JBAS014662 about duplicate path elements for subsystem, but this seemed to be resolved in a version missed by EAP 6.

      It seems like the MDB cannot access the jars in the resource adapter.  Any help with this would be wonderful!

       

      I have the resource adapter defined by:

      <subsystem xmlns="urn:jboss:domain:resource-adapters:1.0">

                <resource-adapters>

                          <resource-adapter>

                                    <archive>

                                              wmq.jmsra.rar

                                    </archive>

                                    <connection-definitions>

                                              <connection-definition class-name="com.ibm.mq.connector.outbound.ManagedQueueConnectionFactoryImpl" jndi-name="java:jboss/eis/ccdbMQCF" pool-name="wmq_jmsra_rar_pool">

                                                        <config-property name="port">

                                                                  1414

                                                        </config-property>

                                                        <config-property name="hostName">

                                                                  localhost

                                                        </config-property>

                                                        <config-property name="channel">

                                                                  local

                                                        </config-property>

                                                        <config-property name="transportType">

                                                                  CLIENT

                                                        </config-property>

                                                        <config-property name="queueManager">

                                                                  local.qm

                                                        </config-property>

                                                        <pool>

                                                                  <min-pool-size>1</min-pool-size>

                                                                  <max-pool-size>10</max-pool-size>

                                                        </pool>

                                                        <security>

                                                                  <application/>

                                                        </security>

                                              </connection-definition>

                                    </connection-definitions>

                                    <admin-objects>

                                              <admin-object class-name="com.ibm.mq.connector.outbound.MQQueueProxy" jndi-name="java:jboss/pRetCust" pool-name="pRetCust">

                                                        <config-property name="baseQueueName">

                                                                  pRetCust

                                                        </config-property>

                                                        <config-property name="baseQueueManagerName">

                                                                  local.qm

                                                        </config-property>

                                              </admin-object>

                                    </admin-objects>

                          </resource-adapter>

                </resource-adapters>

      </subsystem>

       

       

       

       

      The MDB has these annotations and throws the exception when trying to set the MQ Environment variables:

      @Named

      @MessageDriven( name="MqServiceMessageBean",

      activationConfig =

      {

                @ActivationConfigProperty(propertyName = "destinationType",propertyValue = "javax.jms.Queue"),

          @ActivationConfigProperty(propertyName = "destination", propertyValue = "eGetCust")

       

       

      })

      @TransactionAttribute(TransactionAttributeType.NOT_SUPPORTED)

      @ResourceAdapter("wmq.jmsra.rar")

      public class MqServiceBean implements MessageListener {

       

      public void onMessage(Message message) {

                    TextMessage actualMessage = (TextMessage)message;

                    try {

                                    System.out.println("Message class " + message.getClass() + " " + actualMessage.getText());

                          } catch (JMSException e) {

                                    e.printStackTrace();

                          }

         

                    init();

      }

       

      public void init() {

                    System.out.println("MqServiceBean init()");

                          MQEnvironment.hostname = "localhost";

      ...

      }

      }

       

       

      Stack Trace:

      10:59:27,072 INFO  [org.jboss.as.server.deployment] (MSC service thread 1-6) JBAS015876: Starting deployment of "localPosStub-0.0.1-SNAPSHOT.jar"

      10:59:27,088 INFO  [org.jboss.as.ejb3] (MSC service thread 1-15) JBAS014142: Started message driven bean 'MqServiceMessageBean' with 'wmq.jmsra' resource adapter

      10:59:27,119 INFO  [org.jboss.as.server] (DeploymentScanner-threads - 1) JBAS018565: Replaced deployment "localPosStub-0.0.1-SNAPSHOT.jar" with deployment "localPosStub-0.0.1-SNAPSHOT.jar"

      11:02:08,195 INFO  [stdout] (default-short-running-threads-threads - 3) Message class class com.ibm.jms.JMSTextMessage adsf

       

       

      11:02:08,195 INFO  [stdout] (default-short-running-threads-threads - 3) MqServiceBean init()

       

       

      11:02:08,195 ERROR [org.jboss.ejb3.invocation] (default-short-running-threads-threads - 3) JBAS014134: EJB Invocation failed on component MqServiceMessageBean for method public abstract void javax.jms.MessageListener.onMessage(javax.jms.Message): javax.ejb.EJBException: java.lang.RuntimeException: java.lang.NoClassDefFoundError: com/ibm/mq/MQEnvironment

                at org.jboss.as.ejb3.tx.CMTTxInterceptor.invokeInNoTx(CMTTxInterceptor.java:217) [jboss-as-ejb3-7.1.0.Final-redhat-1.jar:7.1.0.Final-redhat-1]

                at org.jboss.as.ejb3.tx.CMTTxInterceptor.notSupported(CMTTxInterceptor.java:288) [jboss-as-ejb3-7.1.0.Final-redhat-1.jar:7.1.0.Final-redhat-1]

                at org.jboss.as.ejb3.tx.CMTTxInterceptor.processInvocation(CMTTxInterceptor.java:188) [jboss-as-ejb3-7.1.0.Final-redhat-1.jar:7.1.0.Final-redhat-1]

                at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.1.Final-redhat-1.jar:1.1.1.Final-redhat-1]

                at org.jboss.as.ejb3.component.interceptors.CurrentInvocationContextInterceptor.processInvocation(CurrentInvocationContextInterceptor.java:41) [jboss-as-ejb3-7.1.0.Final-redhat-1.jar:7.1.0.Final-redhat-1]

                at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.1.Final-redhat-1.jar:1.1.1.Final-redhat-1]

                at org.jboss.as.ejb3.component.interceptors.LoggingInterceptor.processInvocation(LoggingInterceptor.java:59) [jboss-as-ejb3-7.1.0.Final-redhat-1.jar:7.1.0.Final-redhat-1]

                at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.1.Final-redhat-1.jar:1.1.1.Final-redhat-1]

                at org.jboss.as.ee.component.NamespaceContextInterceptor.processInvocation(NamespaceContextInterceptor.java:50) [jboss-as-ee-7.1.0.Final-redhat-1.jar:7.1.0.Final-redhat-1]

                at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.1.Final-redhat-1.jar:1.1.1.Final-redhat-1]

                at org.jboss.as.ejb3.component.messagedriven.MessageDrivenComponentDescription$4$1.processInvocation(MessageDrivenComponentDescription.java:177) [jboss-as-ejb3-7.1.0.Final-redhat-1.jar:7.1.0.Final-redhat-1]

                at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.1.Final-redhat-1.jar:1.1.1.Final-redhat-1]

                at org.jboss.as.ee.component.TCCLInterceptor.processInvocation(TCCLInterceptor.java:45) [jboss-as-ee-7.1.0.Final-redhat-1.jar:7.1.0.Final-redhat-1]

                at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.1.Final-redhat-1.jar:1.1.1.Final-redhat-1]

                at org.jboss.invocation.ChainedInterceptor.processInvocation(ChainedInterceptor.java:61) [jboss-invocation-1.1.1.Final-redhat-1.jar:1.1.1.Final-redhat-1]

                at org.jboss.as.ee.component.ViewService$View.invoke(ViewService.java:165) [jboss-as-ee-7.1.0.Final-redhat-1.jar:7.1.0.Final-redhat-1]

                at org.jboss.as.ee.component.ViewDescription$1.processInvocation(ViewDescription.java:173) [jboss-as-ee-7.1.0.Final-redhat-1.jar:7.1.0.Final-redhat-1]

                at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.1.Final-redhat-1.jar:1.1.1.Final-redhat-1]

                at org.jboss.invocation.ChainedInterceptor.processInvocation(ChainedInterceptor.java:61) [jboss-invocation-1.1.1.Final-redhat-1.jar:1.1.1.Final-redhat-1]

                at org.jboss.as.ee.component.ProxyInvocationHandler.invoke(ProxyInvocationHandler.java:72) [jboss-as-ee-7.1.0.Final-redhat-1.jar:7.1.0.Final-redhat-1]

                at javax.jms.MessageListener$$$view41.onMessage(Unknown Source) [jboss-jms-api_1.1_spec-1.0.0.Final-redhat-1.jar:1.0.0.Final-redhat-1]

                at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [rt.jar:1.6.0_26]

                at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) [rt.jar:1.6.0_26]

                at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) [rt.jar:1.6.0_26]

                at java.lang.reflect.Method.invoke(Method.java:597) [rt.jar:1.6.0_26]

                at org.jboss.as.ejb3.inflow.MessageEndpointInvocationHandler.doInvoke(MessageEndpointInvocationHandler.java:140) [jboss-as-ejb3-7.1.0.Final-redhat-1.jar:7.1.0.Final-redhat-1]

                at org.jboss.as.ejb3.inflow.AbstractInvocationHandler.invoke(AbstractInvocationHandler.java:73) [jboss-as-ejb3-7.1.0.Final-redhat-1.jar:7.1.0.Final-redhat-1]

                at $Proxy55.onMessage(Unknown Source)          at com.ibm.mq.connector.inbound.MessageEndpointWrapper.onMessage(MessageEndpointWrapper.java:131)

                at com.ibm.mq.jms.MQSession$FacadeMessageListener.onMessage(MQSession.java:147)

                at com.ibm.msg.client.jms.internal.JmsSessionImpl.run(JmsSessionImpl.java:2639)

                at com.ibm.mq.jms.MQSession.run(MQSession.java:862)

                at com.ibm.mq.connector.inbound.WorkImpl.run(WorkImpl.java:229)

                at org.jboss.jca.core.workmanager.WorkWrapper.run(WorkWrapper.java:212)

                at org.jboss.threads.SimpleDirectExecutor.execute(SimpleDirectExecutor.java:33)

                at org.jboss.threads.QueueExecutor.runTask(QueueExecutor.java:801)

                at org.jboss.threads.QueueExecutor.access$100(QueueExecutor.java:45)

                at org.jboss.threads.QueueExecutor$Worker.run(QueueExecutor.java:821)

                at java.lang.Thread.run(Thread.java:662) [rt.jar:1.6.0_26]

                at org.jboss.threads.JBossThread.run(JBossThread.java:122)

      Caused by: java.lang.RuntimeException: java.lang.NoClassDefFoundError: com/ibm/mq/MQEnvironment

                ... 40 more

      Caused by: java.lang.NoClassDefFoundError: com/ibm/mq/MQEnvironment

                at com.advance.fif.epcfe.service.MqServiceBean.init(MqServiceBean.java:51) [localPosStub-0.0.1-SNAPSHOT.jar:]

                at com.advance.fif.epcfe.service.MqServiceBean.onMessage(MqServiceBean.java:81) [localPosStub-0.0.1-SNAPSHOT.jar:]

                at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [rt.jar:1.6.0_26]

                at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) [rt.jar:1.6.0_26]

                at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) [rt.jar:1.6.0_26]

                at java.lang.reflect.Method.invoke(Method.java:597) [rt.jar:1.6.0_26]

                at org.jboss.as.ee.component.ManagedReferenceMethodInterceptorFactory$ManagedReferenceMethodInterceptor.processInvocation(ManagedReferenceMethodInterceptorFactory.java:72) [jboss-as-ee-7.1.0.Final-redhat-1.jar:7.1.0.Final-redhat-1]

                at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.1.Final-redhat-1.jar:1.1.1.Final-redhat-1]

                at org.jboss.invocation.WeavedInterceptor.processInvocation(WeavedInterceptor.java:53) [jboss-invocation-1.1.1.Final-redhat-1.jar:1.1.1.Final-redhat-1]

                at org.jboss.as.ee.component.interceptors.UserInterceptorFactory$1.processInvocation(UserInterceptorFactory.java:36) [jboss-as-ee-7.1.0.Final-redhat-1.jar:7.1.0.Final-redhat-1]

                at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.1.Final-redhat-1.jar:1.1.1.Final-redhat-1]

                at org.jboss.invocation.InitialInterceptor.processInvocation(InitialInterceptor.java:21) [jboss-invocation-1.1.1.Final-redhat-1.jar:1.1.1.Final-redhat-1]

                at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.1.Final-redhat-1.jar:1.1.1.Final-redhat-1]

                at org.jboss.invocation.ChainedInterceptor.processInvocation(ChainedInterceptor.java:61) [jboss-invocation-1.1.1.Final-redhat-1.jar:1.1.1.Final-redhat-1]

                at org.jboss.as.ee.component.interceptors.ComponentDispatcherInterceptor.processInvocation(ComponentDispatcherInterceptor.java:53) [jboss-as-ee-7.1.0.Final-redhat-1.jar:7.1.0.Final-redhat-1]

                at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.1.Final-redhat-1.jar:1.1.1.Final-redhat-1]

                at org.jboss.as.ejb3.component.pool.PooledInstanceInterceptor.processInvocation(PooledInstanceInterceptor.java:51) [jboss-as-ejb3-7.1.0.Final-redhat-1.jar:7.1.0.Final-redhat-1]

                at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.1.Final-redhat-1.jar:1.1.1.Final-redhat-1]

                at org.jboss.as.ejb3.tx.CMTTxInterceptor.invokeInNoTx(CMTTxInterceptor.java:211) [jboss-as-ejb3-7.1.0.Final-redhat-1.jar:7.1.0.Final-redhat-1]

                ... 39 more

      Caused by: java.lang.ClassNotFoundException: com.ibm.mq.MQEnvironment from [Module "deployment.localPosStub-0.0.1-SNAPSHOT.jar:main" from Service Module Loader]

                at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:190)

                at org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked(ConcurrentClassLoader.java:468)

                at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:456)

                at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:423)

                at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:398)

                at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:120)

                ... 58 more