jQuery in Action, 2nd edition*
The moose likes JBoss/WildFly and the fly likes Problem integrating Jboss with IBM MQ using JCA resource adaptors Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Products » JBoss/WildFly
Bookmark "Problem integrating Jboss with IBM MQ using JCA resource adaptors" Watch "Problem integrating Jboss with IBM MQ using JCA resource adaptors" New topic
Author

Problem integrating Jboss with IBM MQ using JCA resource adaptors

Ritz Shetty
Greenhorn

Joined: Apr 11, 2008
Posts: 2
I am in a process of integrating Jboss with the remote IBM MQ. I followed the JCA way of configuring the remote MQ on Jboss appserver.
I am able to send and receive message using JMS api using this config . But when i try to configure the MDB's to talk to remote MQ through resource adaptors i get the following exception

2008-04-02 16:23:55,483 DEBUG [org.jboss.ejb.plugins.inflow.JBossMessageEndpointFactory] Starting failed jboss.j2ee:service=EJB,plugin=invoker,binding=wsmq-message-driven-bean,jndiName=local/HistorySubscriberAdaptor@13977592
org.jboss.deployment.DeploymentException: Endpoint activation failed ra=jboss.jca:service=RARDeployment,name='wmq.jmsra.rar' activationSpec=javax.jms.Queue:MYPROJ.MYQUEUE@@localhost; - nested throwable: (javax.resource.spi.ResourceAdapterInternalException: javax.jms.JMSException: MQJMS2005: failed to create MQQueueManager for 'localhost:')
at org.jboss.deployment.DeploymentException.rethrowAsDeploymentException(DeploymentException.java:39)
at org.jboss.ejb.plugins.inflow.JBossMessageEndpointFactory.activate(JBossMessageEndpointFactory.java:477)
at org.jboss.ejb.plugins.inflow.JBossMessageEndpointFactory.startService(JBossMessageEndpointFactory.java:210)
at org.jboss.system.ServiceMBeanSupport.jbossInternalStart(ServiceMBeanSupport.java:274)
at org.jboss.system.ServiceMBeanSupport.jbossInternalLifecycle(ServiceMBeanSupport.java:230)
at sun.reflect.GeneratedMethodAccessor2.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:141)
at org.jboss.mx.server.Invocation.dispatch(Invocation.java:80)
at org.jboss.mx.server.Invocation.invoke(Invocation.java:72)
at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:245)
at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:644)
at org.jboss.system.ServiceController$ServiceProxy.invoke(ServiceController.java:943)
at $Proxy0.start(Unknown Source)


Caused by: javax.resource.spi.ResourceAdapterInternalException: javax.jms.JMSException: MQJMS2005: failed to create MQQueueManager for 'localhost:'
at com.ibm.mq.connector.ResourceAdapterConnectionPool.allocateConnection(ResourceAdapterConnectionPool.java:297)
at com.ibm.mq.connector.ResourceAdapterImpl.endpointActivation(ResourceAdapterImpl.java:333)
at org.jboss.resource.deployment.RARDeployment.endpointActivation(RARDeployment.java:275)
at org.jboss.resource.deployment.RARDeployment.internalInvoke(RARDeployment.java:226)
at org.jboss.system.ServiceDynamicMBeanSupport.invoke(ServiceDynamicMBeanSupport.java:142)
at org.jboss.mx.server.RawDynamicInvoker.invoke(RawDynamicInvoker.java:150)
at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:644)
at org.jboss.ejb.plugins.inflow.JBossMessageEndpointFactory.activate(JBossMessageEndpointFactory.java:472)
... 155 more
Caused by: javax.jms.JMSException: MQJMS2005: failed to create MQQueueManager for 'localhost:'
at com.ibm.mq.jms.services.ConfigEnvironment.newException(ConfigEnvironment.java:586)
at com.ibm.mq.jms.MQConnection.createQM(MQConnection.java:2301)
at com.ibm.mq.jms.MQConnection.createQMNonXA(MQConnection.java:1703)
at com.ibm.mq.jms.MQConnection.<init>(MQConnection.java:805)
at com.ibm.mq.jms.MQConnectionFactory.createConnection(MQConnectionFactory.java:4774)
at com.ibm.mq.connector.ResourceAdapterConnectionPool.initializeJMSConnection(ResourceAdapterConnectionPool.java:445)
at com.ibm.mq.connector.ResourceAdapterConnectionPool.createNewConnection(ResourceAdapterConnectionPool.java:359)
at com.ibm.mq.connector.ResourceAdapterConnectionPool.allocateConnection


Do you have any document which explains how to do this sort of setup.

The configurations are as given below.

Your help would be greatly appreciated
I am using Jboss 4.02 , connected to IBM MQ (Websphere 6.0.2)



*************************************************************The Connection factory is as given below*************************************************************

<no-tx-connection-factory>
<jndi-name>MYPROJQCF</jndi-name>
<xa-transaction/>
<rar-name>wmq.jmsra.rar</rar-name>
<connection-definition>javax.jms.ConnectionFactory</connection-definition>
<config-property name="hostName" type="java.lang.String">10.158.105.70</config-property>
<config-property name="queueManager" type="java.lang.String">CL01</config-property>
<config-property name="transportType" type="java.lang.String">CLIENT</config-property>
<config-property name="userName" type="java.lang.String">![CDATA[ ]]</config-property>
<config-property name="password" type="java.lang.String">![CDATA[ ]]</config-property>
<config-property name="channel" type="java.lang.String">MYPROJ1.SVRCONN</config-property>
<max-pool-size>10</max-pool-size>
<use-java-context>false</use-java-context>
<security-domain-and-application>JmsXARealm</security-domain-and-application>
<config-property name="transportType" type="java.lang.String">CLIENT</config-property>
</no-tx-connection-factory>




<mbean code="org.jboss.jms.jndi.JMSProviderLoader"
name="jboss.mq:service=JMSProviderLoader,name=WSMQJMSProvider">
<attribute name="ProviderName">WSMQJMSProvider</attribute>
<attribute name="ProviderAdapterClass">org.jboss.jms.jndi.JNDIProviderAdapter</attribute>
<attribute name="QueueFactoryRef">jms/RemoteIBMMQConnectionFactory</attribute>
<attribute name="TopicFactoryRef">jms/RemoteIBMMQConnectionFactory</attribute>
</mbean>

<mbean code="org.jboss.resource.deployment.AdminObject" name="jboss.jca:service=WASDestination,name=MYPROJ.MYQUEUE">
<depends optional-attribute-name="RARName">jboss.jca:service=RARDeployment,name='wmq.jmsra.rar'</depends>
<attribute name="JNDIName">MYPROJ.MYQUEUE</attribute>
<attribute name="Type">javax.jms.Queue</attribute>
<attribute name="Properties">
baseQueueManagerName=CL01
baseQueueName=SYSTEM.JMS.D.MYPROJ.HISTORY.MESSAGE
</attribute>
</mbean>




*********************************************Config for ejb-jar.xml***************************************************************************************************************************************

<message-driven id="MessageDriven_1133911907352">
<ejb-name>HistorySubscriberAdaptor</ejb-name>
<ejb-class>livexp.services.history.ejb.HistorySubscriberAdaptor</ejb-class>
<messaging-type>javax.jms.MessageListener</messaging-type>
<transaction-type>Container</transaction-type>
<activation-config>
<activation-config-property>
<activation-config-property-name>destination</activation-config-property-name>
<activation-config-property-value>MYPROJ.MYQUEUE</activation-config-property-value>
</activation-config-property>
<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>false</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>

<resource-ref>
<res-ref-name>jms/RemoteIBMMQConnectionFactory</res-ref-name>
<res-type>javax.jms.ConnectionFactory</res-type>
<res-auth>Container</res-auth>
<!--res-sharing-scope>Unshareable</res-sharing-scope-->
</resource-ref>

<!--resource-env-ref>
<resource-env-ref-name>jms/MYPROJ.MYQUEUE</resource-env-ref-name>
<resource-env-ref-type>javax.jms.Queue</resource-env-ref-type>
</resource-env-ref-->

<message-destination-ref>
<message-destination-ref-name>jms/MYPROJ.MYQUEUE</message-destination-ref-name>
<message-destination-type>javax.jms.Queue</message-destination-type>
<message-destination-link>jms/HistoryQueue</message-destination-link>
<message-destination-usage>Consumes</message-destination-usage>
</message-destination-ref>



</message-driven>


*********************************jboss.xml********************************************************

<message-driven>
<resource-adapter-name>wmq.jmsra.rar</resource-adapter-name>
<ejb-name>HistorySubscriberAdaptor</ejb-name>
<configuration-name>WSMQ Message Driven Bean</configuration-name>
<resource-ref>
<res-ref-name>jms/RemoteIBMMQConnectionFactory</res-ref-name>
<jndi-name>MYPROJQCF</jndi-name>
</resource-ref>

</message-driven>


<assembly-descriptor>
<message-destination>
<message-destination-name>jms/HistoryQueue</message-destination-name>
<jndi-name>MYPROJ.MYQUEUE</jndi-name>
</message-destination>
</assembly-descriptor>

<resource-managers>
<resource-manager>
<res-name>jms/RemoteIBMMQConnectionFactory</res-name>
<res-jndi-name>MYPROJQCF</res-jndi-name>
</resource-manager>

</resource-managers>




<container-configuration>
<container-name>WSMQ Message Driven Bean</container-name>
<call-logging>false</call-logging>
<invoker-proxy-binding-name>wsmq-message-driven-bean</invoker-proxy-binding-name>
<container-interceptors>
<interceptor>org.jboss.ejb.plugins.ProxyFactoryFinderInterceptor</interceptor>
<interceptor>org.jboss.ejb.plugins.LogInterceptor</interceptor>
<interceptor>org.jboss.ejb.plugins.RunAsSecurityInterceptor</interceptor>
<!-- CMT -->
<interceptor transaction="Container">org.jboss.ejb.plugins.TxInterceptorCMT</interceptor>
<interceptor transaction="Container">org.jboss.ejb.plugins.CallValidationInterceptor</interceptor>
<interceptor transaction="Container" metricsEnabled="true">org.jboss.ejb.plugins.MetricsInterceptor</interceptor>
<interceptor transaction="Container">org.jboss.ejb.plugins.MessageDrivenInstanceInterceptor</interceptor>
<!-- BMT -->
<interceptor transaction="Bean">org.jboss.ejb.plugins.MessageDrivenInstanceInterceptor</interceptor>
<interceptor transaction="Bean">org.jboss.ejb.plugins.MessageDrivenTxInterceptorBMT</interceptor>
<interceptor transaction="Bean">org.jboss.ejb.plugins.CallValidationInterceptor</interceptor>
<interceptor transaction="Bean" metricsEnabled="true">org.jboss.ejb.plugins.MetricsInterceptor</interceptor>
<interceptor>org.jboss.resource.connectionmanager.CachedConnectionInterceptor</interceptor>
</container-interceptors>
<instance-pool>org.jboss.ejb.plugins.MessageDrivenInstancePool</instance-pool>
<instance-cache></instance-cache>
<persistence-manager></persistence-manager>
<container-pool-conf>
<MaximumSize>100</MaximumSize>
</container-pool-conf>
</container-configuration>



<invoker-proxy-binding>
<name>wsmq-message-driven-bean</name>
<invoker-mbean>default</invoker-mbean>
<proxy-factory>org.jboss.ejb.plugins.inflow.JBossMessageEndpointFactory</proxy-factory>

<proxy-factory-config>
<JMSProviderAdaptorJNDI>WSMQJMSProvider</JMSProviderAdaptorJNDI>
<ServerSessionPoolFactoryJNDI>StdJMSPool</ServerSessionPoolFactoryJNDI>
<CreateJBossMQDestination>false</CreateJBossMQDestination>
<MaximumSize>15</MaximumSize>
<MaxMessages>1</MaxMessages>
<MDBConfig>
<ReconnectIntervalSec>10</ReconnectIntervalSec>
<DLQConfig>
<DestinationQueue>jms/MYPROJ.MYQUEUE</DestinationQueue>
<MaxTimesRedelivered>10</MaxTimesRedelivered>
<TimeToLive>0</TimeToLive>
</DLQConfig>
</MDBConfig>
<endpoint-interceptors>
<interceptor>org.jboss.proxy.ClientMethodInterceptor</interceptor>
<interceptor>org.jboss.ejb.plugins.inflow.MessageEndpointInterceptor</interceptor>
<interceptor>org.jboss.proxy.TransactionInterceptor</interceptor>
<interceptor>org.jboss.invocation.InvokerInterceptor</interceptor>
</endpoint-interceptors>
</proxy-factory-config>
</invoker-proxy-binding>
babu jayaraman
Greenhorn

Joined: Jan 05, 2006
Posts: 6
Hi
i am also try to integrate websphere Mq with Jboss i got same error.
U got solution for that problem.

please help to solve.

regards
Babu
Ritz Shetty
Greenhorn

Joined: Apr 11, 2008
Posts: 2
I found the problem. For JCA way to work the MQ server needs to be on a specific version. I guess this version is 6.0.2.1

Integrating Jboss with IBM MQ is easy but the real problem is when you want to have a connection pool and manageability like JMX.
For that i used the following approach. Create a Datasource like below.
You need the .bindings file from the MQ Adminitrators. Place it on the server location as given below config

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

<connection-factories>

<!-- The WSMQ JMS provider loader -->
<mbean code="org.jboss.jms.jndi.JMSProviderLoader"
name="jboss.mq:service=JMSProviderLoader,name=RemoteWSMQJMSProvider">
<attribute name="ProviderName">RemoteWSMQJMSProvider</attribute>
<attribute name="ProviderAdapterClass">org.jboss.jms.jndi.JNDIProviderAdapter</attribute>
<!-- This MyQCF should be present in the .bindings file -->

<attribute name="QueueFactoryRef">remotewsmq/MyQCF</attribute>
<attribute name="TopicFactoryRef">remotewsmq/MyQCF</attribute>
</mbean>

<!-- The WSMQ JMS connection factory -->
<no-tx-connection-factory>
<jndi-name>RemoteWSMQJms</jndi-name>
<rar-name>jms-ra.rar</rar-name>
<connection-definition>org.jboss.resource.adapter.jms.JmsConnectionFactory</connection-definition>
<config-property name="SessionDefaultType" type="java.lang.String">javax.jms.Topic</config-property>
<config-property name="JmsProviderAdapterJNDI" type="java.lang.String">java:/RemoteWSMQJMSProvider</config-property>
<max-pool-size>50</max-pool-size>
</no-tx-connection-factory>

<!-- Bind a remote IBM MQ server -->
<mbean code="org.jboss.naming.ExternalContext"
name="jboss.jndi:service=ExternalContext,jndiName=remotewsmq">
<attribute name="JndiName">remotewsmq</attribute>
<attribute name="Properties">
java.naming.factory.initial=com.sun.jndi.fscontext.RefFSContextFactory
java.naming.provider.url=file:///sr1/app/deploy/sunjndi
</attribute>
<attribute name="InitialContext">javax.naming.InitialContext</attribute>
</mbean>
</connection-factories>


In your code You now lookup on connection factory using java:/RemoteWSMQJms. Also you can lookup on Queues using remotewsmq/MyQueueNameJNDI
Here MyQueueNameJNDI should be present in the .bindings file


Your MDB's can also be configured in similar way just that the jndi name has to be remotewsmq/MyQueueNameJNDI in Jboss.xml. You also need to configure container-configuration and Invoker-proxy config in your jboss.xml for your MDB's to work fine
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Problem integrating Jboss with IBM MQ using JCA resource adaptors
 
Similar Threads
JMS Configuration
MDB deployed in WebLogic and Queues in IBM MQ
Message lost or are not pulled by MDB
IBM Websphere v6 and JBoss 4x MQ Connectivity - Please Help
Problem with JMS queues after upgrading to jboss 5.1.0 GA