Jboss5 + IBM websphere MQ integration
rob_gar_esp Apr 28, 2014 10:10 AMHi JBoss people,
I'm developing a JMS app that will get connected to Websphere MQ, my app works ok with both Jboss 6 and 7, unfortunately my customer uses old Jboss 5, I created a config file that looks like:
<?xml version="1.0" encoding="UTF-8"?>
<connection-factories>
<tx-connection-factory>
<jndi-name>jms/mqConnectionFactory</jndi-name>
<xa-transaction/>
<rar-name>wmq.jmsra.rar</rar-name>
<connection-definition>javax.jms.QueueConnectionFactory</connection-definition>
<config-property name="channel" type="java.lang.String">SYSTEM.DEF.SVRCONN</config-property>
<config-property name="hostName" type="java.lang.String">xx.xx.xx.xx</config-property>
<config-property name="port" type="java.lang.String">1417</config-property>
<config-property name="queueManager" type="java.lang.String">MQ_JMS_MANAGER</config-property>
<config-property name="transportType" type="java.lang.String">CLIENT</config-property>
<security-domain-and-application>JmsXARealm</security-domain-and-application>
</tx-connection-factory>
<mbean code="org.jboss.resource.deployment.AdminObject"
name="jca.wmq:name=testQueueOne">
<attribute name="JNDIName">jms/testQueueOne</attribute>
<!-- this MBean depends on the WebSphere MQ resource adapter -->
<depends optional-attribute-name="RARName">
jboss.jca:service=RARDeployment,name='wmq.jmsra.rar'
</depends>
<attribute name="Type">javax.jms.Queue</attribute>
<attribute name="Properties">
baseQueueManagerName=MQ_JMS_MANAGER
baseQueueName=TestQueueOne
</attribute>
</mbean>
<mbean code="org.jboss.resource.deployment.AdminObject"
name="jca.wmq:name=testQueueTwo">
<attribute name="JNDIName">jms/testQueueTwo</attribute>
<depends optional-attribute-name="RARName">
jboss.jca:service=RARDeployment,name='wmq.jmsra.rar'
</depends>
<attribute name="Type">javax.jms.Queue</attribute>
<attribute name="Properties">
baseQueueManagerName=MQ_JMS_MANAGER
baseQueueName=TestQueueTwo
</attribute>
</mbean>
</connection-factories>
The connection-factory gets established, but the app canno bind to the queues, the error is:
Cannot resolve reference to bean 'testQueueOne' while setting bean property 'defaultDestination'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'testQueueOne': Invocation of init method failed; nested exception is javax.naming.NamingException: Could not dereference object [Root exception is javax.naming.NameNotFoundException: test QueueOne not bound] at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:289) ~[spring-beans-3.2.8.RELEASE.jar:3.2. 8.RELEASE]
For some reason the JNDI name gets corrupted, so spring cannot find the queue objects:
<jee:jndi-lookup id="mqConnectionFactory" jndi-name="java:comp/env/jms/mqConnectionFactory"/>
<jee:jndi-lookup id="testQueueOne" jndi-name="java:comp/env/jms/testQueueOne"/>
<jee:jndi-lookup id="testQueueTwo" jndi-name="java:comp/env/jms/testQueueTwo"/>
<resource-ref>
<description>mqConnectionFactory</description>
<res-ref-name>jms/mqConnectionFactory</res-ref-name>
<res-type>javax.jms.QueueConnectionFactory</res-type>
<res-auth>Container</res-auth>
<res-sharing-scope>Shareable</res-sharing-scope>
</resource-ref>
<resource-ref>
<description>testQueueOne</description>
<res-ref-name>jms/testQueueOne</res-ref-name>
<res-type>javax.jms.Queue</res-type>
<res-auth>Container</res-auth>
<res-sharing-scope>Shareable</res-sharing-scope>
</resource-ref>
<resource-ref>
<description>testQueueTwo</description>
<res-ref-name>jms/testQueueTwo</res-ref-name>
<res-type>javax.jms.Queue</res-type>
<res-auth>Container</res-auth>
<res-sharing-scope>Shareable</res-sharing-scope>
</resource-ref>
As mentioned before, the same WAR works in jboss 6 and 7, but not in jboss 5.
Kindly assist, thanks.