How to install WebSphere MQ resource adapter (wmq.jmsra.rar) in JBoss 6.2 EAP?

9.7k views Asked by At

Design: I have a queue manager (EXAMPLE.QM) with Server-connection channel (EXAMPLE.CHANNEL), request queue (EXAMPLE.TEST.QUEUE), and reply queue (EXAMPLE.TEST.REPLY). My application will be using a message driven bean (MDB) to listen on EXAMPLE.TEST.QUEUE. When message arrives an instance of MDB is created and business logic is done which includes quering databases and then the reply is put on the EXAMPLE.TEST.REPLY queue. This is one transaction. In the event of crashes or any failure the exception will be caught and everything will be rolled back. I wanted to do the connection pooling for both MQ and Databases on the server side.

Setup: WebSphere MQ 7.0.1, JBoss 6.2 EAP, Java 1.7.0_21, IBM DB2 9.7

I obtained the wmq.jmsra.rar from the MQ_INSTALLATION_PATH\java\lib\jca and I also got the com.ibm.mqetclient.jar

As per Redhat installation guide in order to support XATransactions I repackaged the wmq.jmsra.rar to include com.ibm.mqetclient.jar using command jar -uf wmq.jmsra.rar com.ibm.mqetclient.jar

You can skip the next paragraph and look at the xml snippet provided below for same information.

After doing so instead manually dropping the wmq.jmsra.rar into JBoss deployment directory I used the management console. I then went ahead and added in profile view under Resource adapters. I set Archive to wmq.jmsra.rar and TX to XATransaction. I then set the properties to the following: logWriterEnabled - true, maxConnections - 10, reconnectionRetryCount - 5, traceLevel - 6, traceEnabled - true, reconnectionRetryInterval - 300000, and connectionConcurrency - 5. After doing so I added a connection definition. I named it WMQ_ConnectionFactory, JNDI - java:jboss/WMQ_ConnectionFactory, and Connection Class - com.ibm.mq.connector.outbound.ManagedConnectionFactoryImpl. I set the properties as follow: port - 1414, hostName - localhost, channel - EXAMPLE.CHANNEL, transportType - BINDINGS_THEN_CLIENT, failIfQuiesce - true, and queueManager - EXAMPLE.QM. I then went on to add 2 Admin Objects. 1st I named EXAMPLE_REQ_Queue, JNDI - java:jboss/EXAMPLE_REQ_Queue, and Class name - com.ibm.mq.connector.outbound.MQQueueProxy. I have it the following properties: useJNDI - true, readAheadClosePolicy - ALL, startTimeout - 10000, destination - EXAMPLE.TEST.REQUEST, and destinationType - javax.jms.Queue. The 2nd admin object I named EXAMPLE_REP_Queue, JNDI - java:jboss/EXAMPLE_REP-Queue, and class name - com.ibm.mq.connector.outbound.MQQueueProxy. I gave it the following properties: failifQuiesce - true, baseQueueManagerName - EXAMPLE.QM, persistence - HIGH, encoding - NNN, baseQueueName - EXAMPLE.TEST.REPLY, targetClient - MQ, and expiry 300000.

Here is a snippet from the standalone.xml file

<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="maxConnections">
                    10
                </config-property>
                <config-property name="traceEnabled">
                    true
                </config-property>
                <config-property name="traceLevel">
                    6
                </config-property>
                <config-property name="reconnectionRetryCount">
                    5
                </config-property>
                <config-property name="reconnectionRetryInterval">
                    300000
                </config-property>
                <config-property name="connectionConcurrency">
                    5
                </config-property>
                <connection-definitions>
                    <connection-definition class-name="com.ibm.mq.connector.outbound.ManagedConnectionFactoryImpl" jndi-name="java:jboss/WMQ_ConnectionFacotry" enabled="true" pool-name="WMQ_ConnectionFactory">
                        <config-property name="port">
                            1414
                        </config-property>
                        <config-property name="hostName">
                            localhost
                        </config-property>
                        <config-property name="channel">
                            EXAMPLE.CHANNEL
                        </config-property>
                        <config-property name="failIfQuiesce">
                            true
                        </config-property>
                        <config-property name="transportType">
                            BINDINGS_THEN_CLIENT
                        </config-property>
                        <config-property name="queueManager">
                            EXAMPLE.QM
                        </config-property>
                        <security>
                            <application/>
                        </security>
                        <validation>
                            <background-validation>false</background-validation>
                        </validation>
                    </connection-definition>
                </connection-definitions>
                <admin-objects>
                    <admin-object class-name="com.ibm.mq.connector.outbound.MQQueueProxy" jndi-name="java:jboss/EXAMPLE_REQ_Queue" enabled="true" use-java-context="false" pool-name="EXAMPLE_REQ_Queue">
                        <config-property name="useJNDI">
                            true
                        </config-property>
                        <config-property name="startTimeout">
                            10000
                        </config-property>
                        <config-property name="destination">
                            EXAMPLE.TEST.REQUEST
                        </config-property>
                        <config-property name="readAheadClosePolicy">
                            ALL
                        </config-property>
                    </admin-object>
                    <admin-object class-name="com.ibm.mq.connector.outbound.MQQueueProxy" jndi-name="java:jboss/EXAMPLE_REP_Queue" enabled="true" use-java-context="false" pool-name="EXAMPLE_REP_Queue">
                        <config-property name="failIfQuiesce">
                            true
                        </config-property>
                        <config-property name="baseQueueManagerName">
                            EXAMPLE.QM
                        </config-property>
                        <config-property name="persistence">
                            HIGH
                        </config-property>
                        <config-property name="encoding">
                            NNN
                        </config-property>
                        <config-property name="baseQueueName">
                            EXAMPLE.TEST.REPLY
                        </config-property>
                        <config-property name="targetClient">
                            MQ
                        </config-property>
                        <config-property name="expiry">
                            300000
                        </config-property>
                    </admin-object>
                </admin-objects>
            </resource-adapter>
        </resource-adapters>
    </subsystem>

The problem: I get the following exception:

15:54:53,325 ERROR [org.jboss.msc.service.fail] (ResourceAdapterDeploymentService Thread Pool -- 1) MSC000001: Failed to start service jboss.ra.deployment."wmq.jmsra.rar": org.jboss.msc.service.StartException in service jboss.ra.deployment."wmq.jmsra.rar": JBAS010446: Failed to start RA deployment [wmq.jmsra] at org.jboss.as.connector.services.resourceadapters.deployment.AbstractResourceAdapterDeploymentService$1.run(AbstractResourceAdapterDeploymentService.java:279) [jboss-as-connector-7.3.0.Final-redhat-14.jar:7.3.0.Final-redhat-14] at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) [rt.jar:1.7.0_21] at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) [rt.jar:1.7.0_21] at java.lang.Thread.run(Thread.java:722) [rt.jar:1.7.0_21] at org.jboss.threads.JBossThread.run(JBossThread.java:122) [jboss-threads-2.1.1.Final-redhat-1.jar:2.1.1.Final-redhat-1] Caused by: org.jboss.jca.deployers.common.DeployException: IJ020060: Unable to inject: com.ibm.mq.connector.outbound.MQQueueProxy property: destination value: EXAMPLE.TEST.REQUEST at org.jboss.jca.deployers.common.AbstractResourceAdapterDeployer.initAdminObject(AbstractResourceAdapterDeployer.java:907) [ironjacamar-deployers-common-1.0.23.Final-redhat-1.jar:1.0.23.Final-redhat-1] at org.jboss.jca.deployers.common.AbstractResourceAdapterDeployer.createObjectsAndInjectValue(AbstractResourceAdapterDeployer.java:2382) [ironjacamar-deployers-common-1.0.23.Final-redhat-1.jar:1.0.23.Final-redhat-1] at org.jboss.as.connector.services.resourceadapters.deployment.ResourceAdapterXmlDeploymentService$AS7RaXmlDeployer.doDeploy(ResourceAdapterXmlDeploymentService.java:185) [jboss-as-connector-7.3.0.Final-redhat-14.jar:7.3.0.Final-redhat-14] at org.jboss.as.connector.services.resourceadapters.deployment.ResourceAdapterXmlDeploymentService.start(ResourceAdapterXmlDeploymentService.java:106) [jboss-as-connector-7.3.0.Final-redhat-14.jar:7.3.0.Final-redhat-14] at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1811) [jboss-msc-1.0.4.GA-redhat-1.jar:1.0.4.GA-redhat-1] at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1746) [jboss-msc-1.0.4.GA-redhat-1.jar:1.0.4.GA-redhat-1] at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) [rt.jar:1.7.0_21] at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) [rt.jar:1.7.0_21] at java.lang.Thread.run(Thread.java:722) [rt.jar:1.7.0_21] 15:54:53,343 INFO [org.jboss.as.server] (Controller Boot Thread) JBAS018559: Deployed "wmq.jmsra.rar" (runtime-name : "wmq.jmsra.rar") 15:54:53,344 INFO [org.jboss.as.controller] (Controller Boot Thread) JBAS014774: Service status report JBAS014777: Services which failed to start: service jboss.ra.deployment."wmq.jmsra.rar": org.jboss.msc.service.StartException in service jboss.ra.deployment."wmq.jmsra.rar": JBAS010446: Failed to start RA deployment [wmq.jmsra]

I guess the main part is Caused by: org.jboss.jca.deployers.common.DeployException: IJ020060: Unable to inject: com.ibm.mq.connector.outbound.MQQueueProxy property: destination value: EXAMPLE.TEST.REQUEST Prior to this I had the same error and instead it said destinationType value: javax.jms.Queue. I then went ahead and removed that property and tried again and now I got this error. I am not certain what to do next.

Tutorials I have been following: IBM - The WebSphere MQ resource adapter, Redhat Jboss Documentation - JCA Architecture Chapter, and Oracle - Message Driven Beans Java EE6 tutorial

My rep only allows me to post 2 links so the last two tutorials are not linked. Any help will be greatly appreciated.

2

There are 2 answers

0
PAujla On BEST ANSWER

I eventually ended up removing all the properties that were causing the exception to pop up. The properties I was trying to set were for inbound communication and it turns out this wasn't really the appropriate place to set them. Instead these should be set in the deployment descriptor of the Message Drive Bean (MDB). The file is called ejb-jar.xml. The content are as follow:

<?xml version="1.0" encoding="UTF-8"?>
<ejb-jar xmlns="http://java.sun.com/xml/ns/javaee"
     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"
     version="3.0"
>
<enterprise-beans>
     <message-driven>
          <ejb-name>MyMDB</ejb-name>
          <ejb-class>com.foo.MyMDB</ejb-class>
          <messaging-type>javax.jms.MessageListener</messaging-type>
          <transaction-type>Container</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>
                         EXAMPLE.TEST.REQUEST
                    </activation-config-property-value>
                </activation-config-property>
                <!--SET OTHER PROPERTIES-->
          </activation-config>
     </message-driven>
</enterprise-beans>
</ejb-jar>

Hope this helps.

0
Nicholas On

I had slightly different issues deploying the MQ RAR to JBoss, but the solution and procedure outlined here should work for you. The specific files to look at are here. The files are iron-jacamar (the jboss as JCA provider) descriptors.

  • ra.xml: The WMQ RAR descriptor
  • ironjacamar.xml: Defines the WMQ connection parameters and admin objects.