9 Replies Latest reply on May 8, 2017 10:32 PM by Paramesh Ande

    How to configure JMS with IBM MQ in JBOSS EAP6

    Upendar D Newbie

      HI,

       

      I'm using JBOSS EAP 6 version, we have requirement where the application running in Jboss to consume the messages posted in IBM MQ and then forward response to the same destination (MQ). Could you please help me how to configure JMS and coding to achieve this. I new the Foreign JMS binding files and Message Bridge in Weblogic using Admin console. But i dont know JMS configuration in JBoss. Pls provide more details with examples to make me understand better.

       

      Thank You

        • 1. Re: How to configure JMS with IBM MQ in JBOSS EAP6
          Doug Grove Newbie

          You would first want to deploy the IBM JCA file - wmq.jmsra.rar - using either the JBoss web-ui or the CLI tool.

          Then, to your standalone-*.xml file, add:


          {code}

              <system-properties>

                  <property name="com.ibm.msg.client.commonservices.trace.status" value="OFF"/>

                  <property name="com.ibm.msg.client.commonservices.trace.level" value="0"/>

                  <property name="com.ibm.msg.client.commonservices.trace.append" value="true"/>

                  <property name="com.ibm.msg.client.commonservices.trace.startup" value="true"/>

                  <property name="com.ibm.msg.client.commonservices.trace.maxBytes" value="-1"/>

                  <property name="com.ibm.msg.client.commonservices.trace.limit" value="2097152"/>

                  <property name="com.ibm.msg.client.commonservices.trace.count" value="1"/>

                  <property name="com.ibm.msg.client.commonservices.trace.standalone" value="true"/>

                  <property name="com.ibm.msg.client.commonservices.trace.errorStream" value="${jboss.server.log.dir}/wmq-trace-error.log"/>

                  <property name="com.ibm.msg.client.commonservices.trace.outputName" value="${jboss.server.log.dir}/wmq-trace.log"/>

                  <property name="com.ibm.msg.client.commonservices.log.outputName" value="${jboss.server.log.dir}/wmq.log"/>

                  <property name="com.ibm.msg.client.commonservices.log.status" value="ON"/>

                  <property name="com.ibm.msg.client.commonservices.log.maxBytes" value="-1"/>

                  <property name="com.ibm.msg.client.commonservices.log.limit" value="2097152"/>

                  <property name="com.ibm.msg.client.commonservices.log.count" value="1"/>

                  <property name="com.ibm.msg.client.commonservices.log.append" value="true"/>

                  <property name="com.ibm.msg.client.commonservices.ffst.suppress" value="-1"/>

              </system-properties>

          {code}


          and


          {code}

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

                      <resource-adapters>

                          <resource-adapter id="wmq.jmsra.rar">

                              <archive>

                                  wmq.jmsra.rar

                              </archive>

                              <transaction-support>XATransaction</transaction-support>

                              <config-property name="logWriterEnabled">

                                  true

                              </config-property>

                              <config-property name="traceEnabled">

                                  true

                              </config-property>

                              <config-property name="traceLevel">

                                  3

                              </config-property>

                              <config-property name="connectionConcurrency">

                                  2

                              </config-property>

                              <connection-definitions>

                                  <connection-definition class-name="com.ibm.mq.connector.outbound.ManagedConnectionFactoryImpl" jndi-name="java:/jms/wmqCF" enabled="true" use-java-context="true" pool-name="wmqCF" use-ccm="true">

                                      <config-property name="port">

                                          1414

                                      </config-property>

                                      <config-property name="hostName">

                                          10.0.0.150

                                      </config-property>

                                      <config-property name="channel">

                                          SYSTEM.DEF.SVRCONN

                                      </config-property>

                                      <config-property name="transportType">

                                          CLIENT

                                      </config-property>

                                      <config-property name="queueManager">

                                          REDHAT.QUEUE.MANAGER

                                      </config-property>

                                      <xa-pool>

                                          <min-pool-size>10</min-pool-size>

                                          <max-pool-size>100</max-pool-size>

                                          <prefill>true</prefill>

                                          <use-strict-min>true</use-strict-min>

                                          <flush-strategy>FailingConnectionOnly</flush-strategy>

                                      </xa-pool>

                                      <timeout>

                                          <allocation-retry>3</allocation-retry>

                                          <allocation-retry-wait-millis>5000</allocation-retry-wait-millis>

                                      </timeout>

                                      <recovery no-recovery="true"/>

                                  </connection-definition>

                                  <connection-definition class-name="com.ibm.mq.connector.outbound.ManagedTopicConnectionFactoryImpl" jndi-name="java:/jms/wmqTCF" enabled="true" use-java-context="true" pool-name="wmqTCF" use-ccm="true">

                                      <config-property name="port">

                                          ${wmq.port}

                                      </config-property>

                                      <config-property name="hostName">

                                          ${wmq.host}

                                      </config-property>

                                      <config-property name="channel">

                                          SYSTEM.DEF.SVRCONN

                                      </config-property>

                                      <config-property name="transportType">

                                          CLIENT

                                      </config-property>

                                      <config-property name="queueManager">

                                          REDHAT.QUEUE.MANAGER

                                      </config-property>

                                      <xa-pool>

                                          <min-pool-size>10</min-pool-size>

                                          <max-pool-size>100</max-pool-size>

                                          <prefill>true</prefill>

                                          <use-strict-min>true</use-strict-min>

                                          <flush-strategy>FailingConnectionOnly</flush-strategy>

                                      </xa-pool>

                                      <timeout>

                                          <allocation-retry>3</allocation-retry>

                                          <allocation-retry-wait-millis>5000</allocation-retry-wait-millis>

                                      </timeout>

                                      <recovery no-recovery="true"/>

                                  </connection-definition>

                                  <connection-definition class-name="com.ibm.mq.connector.outbound.ManagedConnectionFactoryImpl" jndi-name="java:/jboss/resources/IVTCF" enabled="true" use-java-context="true" pool-name="ivtResourceCF" use-ccm="true">

                                      <config-property name="port">

                                          ${wmq.port}

                                      </config-property>

                                      <config-property name="hostName">

                                          ${wmq.host}

                                      </config-property>

                                      <config-property name="channel">

                                          SYSTEM.DEF.SVRCONN

                                      </config-property>

                                      <config-property name="transportType">

                                          CLIENT

                                      </config-property>

                                      <config-property name="queueManager">

                                          REDHAT.QUEUE.MANAGER

                                      </config-property>

                                  </connection-definition>

                                  <connection-definition class-name="com.ibm.mq.connector.outbound.ManagedConnectionFactoryImpl" jndi-name="java:/jms/ivt/IVTCF" enabled="true" use-java-context="true" pool-name="ivtCF" use-ccm="true">

                                      <config-property name="port">

                                          ${wmq.port}

                                      </config-property>

                                      <config-property name="hostName">

                                          ${wmq.host}

                                      </config-property>

                                      <config-property name="channel">

                                          SYSTEM.DEF.SVRCONN

                                      </config-property>

                                      <config-property name="transportType">

                                          CLIENT

                                      </config-property>

                                      <config-property name="queueManager">

                                          REDHAT.QUEUE.MANAGER

                                      </config-property>

                                  </connection-definition>

                              </connection-definitions>

                              <admin-objects>

                                  <admin-object class-name="com.ibm.mq.connector.outbound.MQQueueProxy" jndi-name="java:/jms/ivt/IVTQueue" enabled="true" pool-name="ivtQueue">

                                      <config-property name="baseQueueManagerName">

                                          REDHAT.QUEUE.MANAGER

                                      </config-property>

                                      <config-property name="baseQueueName">

                                          TEST.QUEUE

                                      </config-property>

                                  </admin-object>

                                  <admin-object class-name="com.ibm.mq.connector.outbound.MQQueueProxy" jndi-name="java:/jms/mqGSS" enabled="true" pool-name="mqGSS">

                                      <config-property name="baseQueueName">

                                          XML.QUEUE

                                      </config-property>

                                      <config-property name="targetClient">

                                          MQ

                                      </config-property>

                                      <config-property name="CCSID">

                                          819

                                      </config-property>

                                      <config-property name="baseQueueManagerName">

                                          REDHAT.QUEUE.MANAGER

                                      </config-property>

                                  </admin-object>

                                  <admin-object class-name="com.ibm.mq.connector.outbound.MQQueueProxy" jndi-name="java:/jms/wmqQueue" use-java-context="true" pool-name="wmqQueue">

                                      <config-property name="baseQueueManagerName">

                                          REDHAT.QUEUE.MANAGER

                                      </config-property>

                                      <config-property name="baseQueueName">

                                          TEST.QUEUE

                                      </config-property>

                                  </admin-object>

                                  <admin-object class-name="com.ibm.mq.connector.outbound.MQQueueProxy" jndi-name="java:/jms/mqTest" enabled="true" pool-name="mqTest">

                                      <config-property name="baseQueueManagerName">

                                          REDHAT.QUEUE.MANAGER

                                      </config-property>

                                      <config-property name="baseQueueName">

                                          TEST.QUEUE

                                      </config-property>

                                  </admin-object>

                                  <admin-object class-name="com.ibm.mq.connector.outbound.MQQueueProxy" jndi-name="java:jboss/jms/queue/gssQueue" use-java-context="true" pool-name="GSS.QUEUE">

                                      <config-property name="baseQueueManagerName">

                                          REDHAT.QUEUE.MANAGER

                                      </config-property>

                                      <config-property name="baseQueueName">

                                          GSS.QUEUE

                                      </config-property>

                                  </admin-object>

                              </admin-objects>

                          </resource-adapter>

                      </resource-adapters>

                  </subsystem>

          {code}


          Obviously, you'll need to change the values above to match your MQ configuration for the destinations and connection factories.


          For inbound delivery to an MDB, your MDB code would look like:


          {code}

          /**

          * WebSphereMQ.java

          *

          * Created on Sep 21, 2012, 9:11:29 AM

          *

          * To the extent possible under law, Red Hat, Inc. has dedicated all copyright to this

          * software to the public domain worldwide, pursuant to the CC0 Public Domain Dedication. This

          * software is distributed without any warranty. 

          *

          * See <http://creativecommons.org/publicdomain/zero/1.0/>.

          *

          */

          package org.jboss.sample.mq;

           

           

          import javax.annotation.PostConstruct;

          import javax.annotation.PreDestroy;

          import javax.ejb.ActivationConfigProperty;

          import javax.ejb.CreateException;

          import javax.ejb.EJBException;

          import javax.ejb.MessageDriven;

          import javax.ejb.TransactionAttribute;

          import javax.ejb.TransactionAttributeType;

          import javax.jms.Connection;

          import javax.jms.ConnectionFactory;

          import javax.jms.JMSException;

          import javax.jms.Message;

          import javax.jms.MessageListener;

          import javax.jms.MessageProducer;

          import javax.jms.Queue;

          import javax.jms.QueueSession;

          import javax.jms.Session;

          import javax.jms.TextMessage;

          import javax.naming.InitialContext;

          import javax.naming.NamingException;

           

           

          import org.jboss.ejb3.annotation.ResourceAdapter;

          import org.jboss.logging.Logger;

           

           

          /**

          * @author grovedc

          *

          */

          @MessageDriven(name = "WebSphereMQ", activationConfig = {

                  @ActivationConfigProperty(propertyName = "maxSession", propertyValue="30"),

                  @ActivationConfigProperty(propertyName = "maxPoolDepth", propertyValue="30"),

                  @ActivationConfigProperty(propertyName = "maxMessages", propertyValue="5"),

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

            @ActivationConfigProperty(propertyName = "useJNDI", propertyValue = "false"),

            @ActivationConfigProperty(propertyName = "hostName", propertyValue = "10.0.0.150"),

            @ActivationConfigProperty(propertyName = "port", propertyValue = "1414"),

            @ActivationConfigProperty(propertyName = "channel", propertyValue = "SYSTEM.DEF.SVRCONN"),

            @ActivationConfigProperty(propertyName = "queueManager", propertyValue = "REDHAT.QUEUE.MANAGER"),

            @ActivationConfigProperty(propertyName = "destination", propertyValue = "GSS.QUEUE"),

            @ActivationConfigProperty(propertyName = "transportType", propertyValue = "CLIENT") })

          @ResourceAdapter(value="wmq.jmsra.rar")

          @TransactionAttribute(TransactionAttributeType.NOT_SUPPORTED)

          public class WebSphereMQ implements MessageListener {

            private static final Logger logger = Logger.getLogger(WebSphereMQ.class);

           

            /*

            * (non-Javadoc)

            *

            * @see javax.jms.MessageListener#onMessage(javax.jms.Message)

            */

            public void onMessage(Message message) {

            try {

            logger.debug("Received message: " + message.getJMSMessageID() + " : " + ((TextMessage)message).getText());

            }

           

           

            @PostConstruct 

              public void ejbCreate() throws CreateException { 

            logger.info("Entering/Exiting ejbCreate");

            } 

           

            @PreDestroy

            public void ejbRemove() throws EJBException { 

            logger.info("Entering/Exiting ejbRemove");

            }

          }

          {code}



          Once again, changing the values of the various ActivationConfigProperty properties.


          Hope that helps,


          Doug

          1 of 1 people found this helpful
          • 2. Re: How to configure JMS with IBM MQ in JBOSS EAP6
            Upendar D Newbie

            Thanks Doug for the response with detailed steps, but here is my requirement

             

            1. Application A will post  message on MQ and also mention the reply queue by using createTemporaryQueue

            () method. - for receiving the message posted by receiver

             

            2. Application B with MDB will consume the message from MQ (posed by step1 above )and constuct some response and then forward to that MQ using getJMSReplyTo()   -  Since application A created a dynamic Q.

             

            3. I need inbound and outbound in MDB to consume and post  the message and  MQ configuration needs to externalized , I mean MBD should not have hardcoding in annotations with MQ host name , destination,port etc...

             

            Looking at above your code, MQ config is hard coded in standalone.xml file and also the annotations hard coded with values.Also there is NO code to forward the message to dynamic Q.

             

            I appriciate if you could help me on this with detailed code and config example. Thanks much for looking into this.

            If possible provide solutuion on EJB3.0 and JBOSS EAP 6 version and even with Spring framework is also fine.

            • 3. Re: How to configure JMS with IBM MQ in JBOSS EAP6
              Upendar D Newbie


              Can any one please update on this

              • 4. Re: How to configure JMS with IBM MQ in JBOSS EAP6
                Martes Wigglesworth Newbie

                Have you taken a look at this issue posted back in 2013, found here?

                • 5. Re: How to configure JMS with IBM MQ in JBOSS EAP6
                  Paramesh Ande Newbie

                  Hi Doug/Martes,

                  Are these Admin objects expected to be available in the JNDI tree of the server?For the message driven bean can we pass java:/jms/wmqQueue as the destination through ejb-jar xml ?

                  For some reason we are not able to look up the MQ queue objects declared in the standalone.xml. Are there any additional steps to be performed to deploy the resource adapter other than the below:

                   

                  1. Deploy the resource adapter wmq.jmsra.rar by placing in the deployments folder
                  2. Update the standalone.xml to set the resource adapter subsystem with appropriate connection details using the tags given in this post.

                   

                  Regards

                  Paramesh

                  • 6. Re: How to configure JMS with IBM MQ in JBOSS EAP6
                    Doug Grove Newbie

                    1) Are these Admin objects expected to be available in the JNDI tree of the server?

                     

                    The admin objects are available in JNDI.  Note the configuration:

                     

                    jndi-name="java:jboss/jms/queue/gssQueue"

                     

                    Note that JBoss now has a couple of different JNDI namespaces.  Using the java:jboss/ namespace will make the objects globally available.

                     

                     

                    2) For the message driven bean can we pass java:/jms/wmqQueue as the destination through ejb-jar xml ?

                     

                    Yes, you can:

                     

                    {code}

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

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

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

                        xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/ejb-jar_3_0.xsd"

                        version="3.0">

                        <display-name>GssEjbJarXML</display-name>

                        <enterprise-beans>

                            <message-driven>

                                <ejb-name>WebSphereXML</ejb-name>

                                <ejb-class>com.redhat.gss.service.ejb30.mdb.WebSphereXML</ejb-class>

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

                                <activation-config>

                                    <activation-config-property>

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

                                        <activation-config-property-value>${wmq.host}</activation-config-property-value>

                                    </activation-config-property>

                                    <activation-config-property>

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

                                        <activation-config-property-value>${wmq.port}</activation-config-property-value>

                                    </activation-config-property>

                                    <activation-config-property>

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

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

                                    </activation-config-property>

                                    <activation-config-property>

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

                                        <activation-config-property-value>SYSTEM.DEF.SVRCONN</activation-config-property-value>

                                    </activation-config-property>

                                    <activation-config-property>

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

                                        <activation-config-property-value>redhat.queue.manager</activation-config-property-value>

                                    </activation-config-property>

                                    <activation-config-property>

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

                                        <activation-config-property-value>GSS.QUEUE</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>

                            </message-driven>

                        </enterprise-beans>

                    {code}

                     

                    3) For some reason we are not able to look up the MQ queue objects declared in the standalone.xml.

                     

                    Please see [1].  I'd guess that your JNDI names are not visible.

                     

                     

                    [1] JNDI Reference - JBoss AS 7.1 - Project Documentation Editor

                    1 of 1 people found this helpful
                    • 7. Re: How to configure JMS with IBM MQ in JBOSS EAP6
                      Paramesh Ande Newbie

                      Hi Doug,

                       

                      Thanks a lot for your prompt resonse.

                      When I tried to pass the jndi name of the MQProxy Admin object in ejb-jar xml,it is taking that as a Queue name and trying to connect to MQ using that string, instead of looking up for the jnidi object.

                      Below are the error logs:

                      Caused by [1] --> Message : com.ibm.mq.MQException: JMSCMQ0001: WebSphere MQ call failed with compcode '2' ('MQCC_FAILED') reason '2085' ('MQRC_UNKNOWN_OBJECT_NAME').

                      12:33:16,012 INFO  [stdout] (ServerService Thread Pool -- 77)                          Class : class com.ibm.mq.MQException

                      12:33:16,033 INFO  [stdout] (ServerService Thread Pool -- 77)                          Stack : com.ibm.msg.client.wmq.common.internal.Reason.createException(Reason.java:209)

                      12:33:16,053 INFO  [stdout] (ServerService Thread Pool -- 77)                                : com.ibm.msg.client.wmq.internal.WMQMessageConsumer.checkJmqiCallSuccess(WMQMessageConsumer.java:129)

                      12:33:16,085 INFO  [stdout] (ServerService Thread Pool -- 77)                                : com.ibm.msg.client.wmq.internal.WMQConsumerShadow.initialize(WMQConsumerShadow.java:988)

                      12:33:16,123 INFO  [stdout] (ServerService Thread Pool -- 77)                                : com.ibm.msg.client.wmq.internal.WMQAsyncConsumerShadow.initialize(WMQAsyncConsumerShadow.java:868)

                      12:33:16,146 INFO  [stdout] (ServerService Thread Pool -- 77)                                : com.ibm.msg.client.wmq.internal.WMQConnectionBrowser.<init>(WMQConnectionBrowser.java:1365)

                      12:33:16,176 INFO  [stdout] (ServerService Thread Pool -- 77)                                : com.ibm.msg.client.wmq.internal.WMQConnection.createConnectionBrowser(WMQConnection.java:826)

                      12:33:16,202 INFO  [stdout] (ServerService Thread Pool -- 77)                                : com.ibm.msg.client.jms.internal.JmsConnectionImpl.createConnectionBrowser(JmsConnectionImpl.java:927)

                      12:33:16,229 INFO  [stdout] (ServerService Thread Pool -- 77)                                : com.ibm.msg.client.jms.internal.JmsConnectionConsumerImpl.createConnectionBrowser(JmsConnectionConsumerImpl.java:240)

                      12:33:16,239 19830421 [com.pega.pegarules.internal.bootstrap.PRBootstrapDataSource] (ServerService Thread Pool -- 60) Archive version [0]

                      12:33:16,266 INFO  [stdout] (ServerService Thread Pool -- 77)                                : com.ibm.msg.client.jms.internal.JmsConnectionConsumerImpl.<init>(JmsConnectionConsumerImpl.java:166)

                      Caused by: java.lang.RuntimeException: com.ibm.mq.connector.DetailedResourceException: MQJCA0001: An exception occurred in the JMS layer. See the linked exception for details., error code: MQJCA0001 A call to WebSphere MQ classes for JMS caused an exception to be thrown. See the linked exception for details of the failure.

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

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

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

                        ... 6 more

                      Caused by: com.ibm.mq.connector.DetailedResourceException: MQJCA0001: An exception occurred in the JMS layer. See the linked exception for details., error code: MQJCA0001 A call to WebSphere MQ classes for JMS caused an exception to be thrown. See the linked exception for details of the failure.

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

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

                        at com.ibm.mq.connector.inbound.MessageEndpointDeployment.startDelivery(MessageEndpointDeployment.java:362)

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

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

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

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

                        ... 8 more

                      Caused by: com.ibm.msg.client.jms.DetailedInvalidDestinationException: JMSWMQ2008: Failed to open MQ queue 'jms/mqTest'.

                      JMS attempted to perform an MQOPEN, but WebSphere MQ reported an error.

                      Use the linked exception to determine the cause of this error. Check that the specified queue and queue manager are defined correctly.

                        at com.ibm.msg.client.wmq.common.internal.Reason.reasonToException(Reason.java:503)

                       

                      Configurations in Standalone.xml:

                       

                      {code}

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

                                  <resource-adapters>

                                      <resource-adapter id="wmq.jmsra.rar">

                                          <archive>

                                              wmq.jmsra.rar

                                          </archive>

                                          <transaction-support>XATransaction</transaction-support>

                                          <config-property name="connectionConcurrency">

                                              2

                                          </config-property>

                                          <config-property name="logWriterEnabled">

                                              true

                                          </config-property>

                                          <config-property name="traceEnabled">

                                              true

                                          </config-property>

                                          <config-property name="traceLevel">

                                              3

                                          </config-property>

                                          <connection-definitions>

                                              <connection-definition class-name="com.ibm.mq.connector.outbound.ManagedConnectionFactoryImpl" jndi-name="java:jboss/exported/jms/wmqCF" enabled="true" use-java-context="true" pool-name="wmqCF" use-ccm="true">

                                                  <config-property name="channel">

                                                      XXXX.CHANNEL

                                                  </config-property>

                                                  <config-property name="hostName">

                                                     [IPADDRESS]

                                                  </config-property>

                                                  <config-property name="transportType">

                                                      CLIENT

                                                  </config-property>

                                                  <config-property name="queueManager">

                                                      NPAT01

                                                  </config-property>

                                                  <config-property name="port">

                                                      1417

                                                  </config-property>

                                                  <xa-pool>

                                                      <min-pool-size>10</min-pool-size>

                                                      <max-pool-size>100</max-pool-size>

                                                      <prefill>true</prefill>

                                                      <use-strict-min>true</use-strict-min>

                                                      <flush-strategy>FailingConnectionOnly</flush-strategy>

                                                  </xa-pool>

                                                  <timeout>

                                                      <allocation-retry>3</allocation-retry>

                                                      <allocation-retry-wait-millis>5000</allocation-retry-wait-millis>

                                                  </timeout>

                                                  <recovery no-recovery="true"/>

                                              </connection-definition>

                                          </connection-definitions>

                                          <admin-objects>

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

                                                  <config-property name="baseQueueName">

                                                     XXXXXXRECEPTION.Q

                                                  </config-property>

                                                  <config-property name="baseQueueManagerName">

                                                      NPAT01

                                                  </config-property>

                                              </admin-object>

                                          </admin-objects>

                                      </resource-adapter>

                                  </resource-adapters>

                              </subsystem>

                      {/code}

                       

                      Activation config parameters to MDB in ejb-jar.xml:

                       

                      {code}

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

                                         jms/mqTest

                                          </activation-config-property-value> 

                                      </activation-config-property> 

                                         

                                      <activation-config-property> 

                                          <activation-config-property-name> 

                                              channel 

                                          </activation-config-property-name> 

                                          <activation-config-property-value> 

                                              GCM.CHANNEL

                                          </activation-config-property-value> 

                                      </activation-config-property>                 

                                      <activation-config-property> 

                                          <activation-config-property-name> 

                                              hostName 

                                          </activation-config-property-name> 

                                          <activation-config-property-value> 

                                             [IPADDRESS]

                                          </activation-config-property-value> 

                                      </activation-config-property>                 

                                      <activation-config-property> 

                                          <activation-config-property-name> 

                                              queueManager 

                                          </activation-config-property-name> 

                                          <activation-config-property-value> 

                                            NPAT01

                                          </activation-config-property-value> 

                                      </activation-config-property>                 

                                      <activation-config-property> 

                                          <activation-config-property-name> 

                                              port 

                                          </activation-config-property-name> 

                                          <activation-config-property-value> 

                                           1417

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

                      {/code}

                       

                       

                      If i pass an additional activation config property as below

                      {code>

                        <activation-config-property> 

                                          <activation-config-property-name> 

                                              useJNDI 

                                          </activation-config-property-name> 

                                          <activation-config-property-value> 

                                          true

                                          </activation-config-property-value> 

                                      </activation-config-property> 

                      {/code}

                      I am getting the Name not found exception as below:

                       

                      Caused by: java.lang.RuntimeException: com.ibm.mq.connector.DetailedResourceException: MQJCA0003: A JNDI naming exception was thrown. See the linked exception for details., error code: MQJCA0003 An attempt to look up a JMS destination in the JNDI namespace failed. Either the namespace cannot be accessed, or a destination with the supplied name is not bound in the namespace.  See the linked exception for details of the failure. Check that the JNDI namespace is available, that a destination with the correct name is bound in the JNDI namespace, and that the value of the property called destination is correctly defined.

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

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

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

                        ... 6 more

                      Caused by: com.ibm.mq.connector.DetailedResourceException: MQJCA0003: A JNDI naming exception was thrown. See the linked exception for details., error code: MQJCA0003 An attempt to look up a JMS destination in the JNDI namespace failed. Either the namespace cannot be accessed, or a destination with the supplied name is not bound in the namespace.  See the linked exception for details of the failure. Check that the JNDI namespace is available, that a destination with the correct name is bound in the JNDI namespace, and that the value of the property called destination is correctly defined.

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

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

                        at com.ibm.mq.connector.DestinationBuilder.createDestination(DestinationBuilder.java:181)

                        at com.ibm.mq.connector.inbound.MessageEndpointDeployment.startDelivery(MessageEndpointDeployment.java:328)

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

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

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

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

                        ... 8 more

                      Caused by: javax.naming.NameNotFoundException: jms/mqTest -- service jboss.naming.context.java.jms.mqTest

                        at org.jboss.as.naming.ServiceBasedNamingStore.lookup(ServiceBasedNamingStore.java:104) [jboss-as-naming.jar:7.5.2.Final-redhat-2]

                        at org.jboss.as.naming.NamingContext.lookup(NamingContext.java:197) [jboss-as-naming.jar:7.5.2.Final-redhat-2]

                        at org.jboss.as.naming.InitialContext$DefaultInitialContext.lookup(InitialContext.java:243) [jboss-as-naming.jar:7.5.2.Final-redhat-2]

                        at org.jboss.as.naming.NamingContext.lookup(NamingContext.java:183) [jboss-as-naming.jar:7.5.2.Final-redhat-2]

                        at org.jboss.as.naming.NamingContext.lookup(NamingContext.java:179) [jboss-as-naming.jar:7.5.2.Final-redhat-2]

                        at javax.naming.InitialContext.lookup(InitialContext.java:417) [rt.jar:1.8.0_51]

                        at javax.naming.InitialContext.lookup(InitialContext.java:417) [rt.jar:1.8.0_51]

                        at com.ibm.mq.connector.DestinationBuilder.createDestination(DestinationBuilder.java:157)

                        ... 13 more

                       

                       

                       

                      Could you please let me know if i am missing any thing here.

                       

                       

                      Regards

                      Paramesh

                      • 8. Re: How to configure JMS with IBM MQ in JBOSS EAP6
                        Doug Grove Newbie

                        Could you try using the java:jboss namespace....

                         

                                        <admin-objects>
                                            <admin-object class-name="com.ibm.mq.connector.outbound.MQQueueProxy" jndi-name="java:jboss/mqQueue" enabled="true" pool-name="ivtQueue">
                                                <config-property name="baseQueueManagerName">
                                                    REDHAT.QUEUE.MANAGER
                                                </config-property>
                                                <config-property name="baseQueueName">
                                                    REDHAT.QUEUE
                                                </config-property>
                                            </admin-object>
                                        </admin-objects>
                        1 of 1 people found this helpful
                        • 9. Re: How to configure JMS with IBM MQ in JBOSS EAP6
                          Paramesh Ande Newbie

                          Hi Doug,

                          Thank you so much for your support. It is working fine with the fully qualified jndi name which includes the java:jboss prefix.

                          Below is the set of tags from the working copy:

                           

                          {code}

                           

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

                                                  useJNDI 

                                              </activation-config-property-name> 

                                              <activation-config-property-value> 

                                              true

                                              </activation-config-property-value> 

                                          </activation-config-property> 

                           

                                          <activation-config-property> 

                                              <activation-config-property-name> 

                                                  destination 

                                              </activation-config-property-name> 

                                              <activation-config-property-value> 

                                              java:jboss/jms/mqTest

                                              </activation-config-property-value> 

                                          </activation-config-property> 

                                           

                                          <activation-config-property> 

                                              <activation-config-property-name> 

                                                  channel 

                                              </activation-config-property-name> 

                                              <activation-config-property-value> 

                                                  [channel]

                                              </activation-config-property-value> 

                                          </activation-config-property>                 

                                          <activation-config-property> 

                                              <activation-config-property-name> 

                                                  hostName 

                                              </activation-config-property-name> 

                                              <activation-config-property-value> 

                                                 [hostName]

                                              </activation-config-property-value> 

                                          </activation-config-property>                 

                                          <activation-config-property> 

                                              <activation-config-property-name> 

                                                  queueManager 

                                              </activation-config-property-name> 

                                              <activation-config-property-value> 

                                                [queueManager]

                                              </activation-config-property-value> 

                                          </activation-config-property>                 

                                          <activation-config-property> 

                                              <activation-config-property-name> 

                                                  port 

                                              </activation-config-property-name> 

                                              <activation-config-property-value> 

                                               1417

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

                          {/code}

                           

                          Is there any way to inject the jndi name of the connection factory as well, instead of duplicating the connection details in both standalone.xml and in ejb-jar.xml so that we can reuse the preconnected object.

                           

                           

                          Regards

                          Paramesh