1 Reply Latest reply on Jan 18, 2018 10:43 AM by Miroslav Novak

    MDB working without jndi name but giving InvalidDestinationException with jndi in ejb-jar.xml

    MaxJboss MaxJboss Newbie

      Hello there, Good Day !!

       

      I am having an EAR project which is having mdb inside separate jar file. When I am deploying my ear with ejb-jar.xml like below everything is working as expected and I am able to send message through jms template and receive through mdb.

      <ejb-jar xmlns="http://java.sun.com/xml/ns/javaee" version="3.0"

      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

      xsi:schemaLocation="http://java.sun.com/xml/ns/javaee

               http://java.sun.com/xml/ns/javaee/ejb-jar_3_0.xsd">

      <enterprise-beans>

      <message-driven>

      <ejb-name>ResponseBean</ejb-name>

      <ejb-class>com.project.ejb.ResponseBean</ejb-class>

      <messaging-type>javax.jms.MessageListener</messaging-type>

      <transaction-type>Bean</transaction-type>

      <activation-config>

      <activation-config-property>

      <activation-config-property-name>destinationType</activation-config-property-name>

      <activation-config-property-value>javax.jms.Queue</activation-config-property-value>

      </activation-config-property>

      <activation-config-property>

      <activation-config-property-name>destination</activation-config-property-name>

      <activation-config-property-value>SE.REPLY.QN42</activation-config-property-value>

      </activation-config-property>

      <!--

      <activation-config-property>

      <activation-config-property-name>useJNDI</activation-config-property-name>

      <activation-config-property-value>true</activation-config-property-value>

      </activation-config-property>

      -->

      <activation-config-property>

      <activation-config-property-name>ccdtURL</activation-config-property-name>

      <activation-config-property-value>file:///appl/sl/ccdt/QA_NONPRD.TAB</activation-config-property-value>

      </activation-config-property>

      <activation-config-property>

      <activation-config-property-name>queueManager</activation-config-property-name>

      <activation-config-property-value>*SEQA</activation-config-property-value>

      </activation-config-property>

      <activation-config-property>

      <activation-config-property-name>transportType</activation-config-property-name>

      <activation-config-property-value>CLIENT</activation-config-property-value>

      </activation-config-property>

      <activation-config-property>

      <activation-config-property-name>maxPoolDepth</activation-config-property-name>

      <activation-config-property-value>100</activation-config-property-value>

      </activation-config-property>

      </activation-config>

      </message-driven>

      </enterprise-beans>

      </ejb-jar>

       

       

      But when I uncomment useJNDI and provide jndi name instead of queue name as below I am getting InvalidDestinationException.

      <activation-config-property>

      <activation-config-property-name>destination</activation-config-property-name>

      <activation-config-property-value>java:/wmq/ResponseQueue</activation-config-property-value>

      </activation-config-property>

      <activation-config-property>

      <activation-config-property-name>useJNDI</activation-config-property-name>

      <activation-config-property-value>true</activation-config-property-value>

      </activation-config-property>



      Exception :

      10:19:27,442 INFO  [org.jboss.as.ejb3] (MSC service thread 1-2) JBAS014142: Started message driven bean 'ResponseBean' with 'wmq.jmsra.rar' resource adapter

      10:19:27,629 ERROR [org.jboss.msc.service.fail] (ServerService Thread Pool -- 50) MSC000001: Failed to start service jboss.deployment.subunit."Wallet.EJB.ear"."Wallet.EJB.jar".component.ResponseBean.START: org.jboss.msc.service.StartException in service jboss.deployment.subunit."Wallet.EJB.ear"."Wallet.EJB.jar".component.ResponseBean.START: java.lang.RuntimeException: javax.resource.ResourceException: MQJCA0001:An exception occurred in the JMS layer. See the linked exception for details.

              at org.jboss.as.ee.component.ComponentStartService$1.run(ComponentStartService.java:57) [wildfly-ee-8.2.0.Final.jar:8.2.0.Final]

              at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) [rt.jar:1.8.0_111]

              at java.util.concurrent.FutureTask.run(FutureTask.java:266) [rt.jar:1.8.0_111]

              at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) [rt.jar:1.8.0_111]

              at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) [rt.jar:1.8.0_111]

              at java.lang.Thread.run(Thread.java:745) [rt.jar:1.8.0_111]

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

      Caused by: java.lang.RuntimeException: javax.resource.ResourceException: MQJCA0001:An exception occurred in the JMS layer. See the linked exception for details.

              at org.jboss.as.ejb3.component.messagedriven.MessageDrivenComponent.activate(MessageDrivenComponent.java:215)

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

              at org.jboss.as.ee.component.ComponentStartService$1.run(ComponentStartService.java:54) [wildfly-ee-8.2.0.Final.jar:8.2.0.Final]

              ... 6 more

      Caused by: javax.resource.ResourceException: MQJCA0001:An exception occurred in the JMS layer. See the linked exception for details.

              at com.ibm.mq.connector.services.JCAExceptionBuilder.buildException(JCAExceptionBuilder.java:103)

              at com.ibm.mq.connector.inbound.MessageEndpointDeployment.start(MessageEndpointDeployment.java:222)

              at com.ibm.mq.connector.inbound.MessageEndpointDeployment.<init>(MessageEndpointDeployment.java:188)

              at com.ibm.mq.connector.ResourceAdapterImpl.endpointActivation(ResourceAdapterImpl.java:379)

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

              at org.jboss.as.ejb3.component.messagedriven.MessageDrivenComponent.activate(MessageDrivenComponent.java:213)

              ... 8 more

      Caused by: javax.jms.InvalidDestinationException: MQJMS0003: Destination not understood or no longer valid

              at com.ibm.mq.jms.MQConnection.createConnectionConsumer(MQConnection.java:3560)

              at com.ibm.mq.connector.inbound.MessageEndpointDeployment.createConnectionConsumer(MessageEndpointDeployment.java:288)

              at com.ibm.mq.connector.inbound.MessageEndpointDeployment.start(MessageEndpointDeployment.java:218)

              ... 12 more

       

      My jndi-name is getting bound to the Queue as I am getting below trace and also able to see in jndi-view in admin console.

      10:19:22,161 INFO  [org.jboss.as.connector.deployment] (MSC service thread 1-2) JBAS010401: Bound JCA AdminObject [java:/wmq/ResponseQueue]

       

      I am deploying my ear application on wildfly 8.2 and below are my dependency jars.

      activation-1.1.jar

      aopalliance-1.0.0.jar

      com.ibm.mq-6.0.2.6.jar

      com.ibm.mqjms-6.0.2.6.jar

      commons-discovery-0.2.jar

      commons-io-1.4.jar

      commons-lang-2.3.jar

      commons-logging-1.1.jar

      ibatis-sqlmap-2.3.0.jar

      j2ee-1.4.jar

      jbossmq-42.0.GA.jar

      log4j-1.2.8.jar

      poi-25.1jar

      quart-1.6.0.jar

      spring-aop-3.0.5.RELEASE.jar

      spring-asm-3.0.5.RELEASE.jar

      spring-beans-3.0.5.RELEASE.jar

      spring-context-3.0.5.RELEASE.jar

      spring-context-support-3.0.5.RELEASE.jar

      spring-core-3.05.RELEASE.jar

      spring-expression-3.0.5.RELEASE.jar

      spring-jdbc-3.0.5.RELEASE.jar

      spring-jms-3.0.5.RELEASE.jar

      spring-orm-3.0.5.RELEASE.jar

      spring-tx-3.0.5.RELEASE.jar

      spring-web-3.0.5.RELEASE.jar

      velocity-1.5.jar

      velocity-dep-1.5.jar

      Wallet.EJB.jar

      Wallet.EJB.war

      Wallet.jar

      xstream-1.3.jar

       

      The queues are hosted on IBM MQ and are working fine.

       

      Kindly help, stuck into this since long I am.

       

      PS I also tried providing java:/wmq/ResponseQueue instead but that also didn't work.

       

      Regards,

      Malhar

        • 1. Re: MDB working without jndi name but giving InvalidDestinationException with jndi in ejb-jar.xml
          Miroslav Novak Master

          I don't think that it's possible to say WebSphereMQ resource adapter to lookup queue for MDB/inbound connection in JNDI tree of WF server. If activation config property destination is defined then the name of queue is searched using WebsphereMQ resource adapter (provider specific) way in remote WebsphereMQ broker and cannot look it up in local jndi tree of WF. WMQ RA does not know the necessary classes.

           

          I also could not find activation-config-property useJNDI in properties for WMQ RA, not sure if it accepts it.

           

          Note that the situation is different when you need to inject this queue to EJB or MDB (for example you might send something to it onMesage() method as reply). Then @Resource annotation allows to inject this queue as it has access to WF JNDI tree.