2 Replies Latest reply on Aug 18, 2006 4:32 PM by mvilot

    IBM WebSphere MQ (WMQ)   with JBOSS/JMS

    amousavizadegan

      Does anyone know how to setup IBM WMQ with JBOSS, an example of sample MDB will be good ?

        • 1. Re: IBM WebSphere MQ (WMQ)   with JBOSS/JMS
          luc.texier

          We've got a new wiki that explains in details how to integrate with WSMQ
          http://wiki.jboss.org/wiki/Wiki.jsp?page=IntegrationWithWebSphereMQSeries

          Part II is coming soon. We're still having issues with the buggy XA implementation of WSMQ when it is used as the JMS provider of the MDB container.

          • 2. Re: IBM WebSphere MQ (WMQ)   with JBOSS/JMS
            mvilot

             

            "amousavizadegan" wrote:
            Does anyone know how to setup IBM WMQ with JBOSS, an example of sample MDB will be good ?

            New post on an old thread, because it's an important problem that needs to be solved. Looks like the published code is incorrect.

            Configuration: jboss-4.0.4.GA with WSMQ 6.0, both running on Windoze. JBoss installer summary: Chosen installation packs
            jmx-core
            minimal
            binding-service
            client-deployer-service
            dynclassloader-service.xml
            ear-deployer
            ejb-timer-service
            ejb-deployer
            hsqldb-ds
            jboss-local-jdbc.rar
            javamail
            jbossretro
            jbossws14
            jca-service
            jdbc-metadata-service
            jbossmq-service
            jms-asf-rar
            jms-injvm-invoker
            jms-socket-invoker
            jmx-console
            invokers-service
            jmx-invoker-service
            jta-service
            usertx-service
            mail-inflow-adaptor
            naming
            security
            war-deployer
            jboss-remoting

            Configured the -ds.xml per http://wiki.jboss.org/wiki/Wiki.jsp?page=IntegrationWithWebSphereMQSeries
            Compiled and deployed the .sar:
            INFO [ResponseQueue] Bound to JNDI name: queue/ResponseQueue
            INFO [RequestQueue] Bound to JNDI name: queue/RequestQueue
            INFO [ConnectionFactoryBindingService] Bound ConnectionManager 'jboss.jca:service=ConnectionFactoryBinding
            ,name=WSMQJms' to JNDI name 'java:WSMQJms'

            From the jmx-console, JNDIView 1st throws the following exception chain (no HA or EJB cache-invalidation-service support in this configuration):
            ERROR [JNDIView] JNDIView.getHAJndiAttributes() failed
            java.lang.NullPointerException: name cannot be null
             at javax.management.ObjectName.construct(ObjectName.java:342)
             at javax.management.ObjectName.<init>(ObjectName.java:1304)
             at org.jboss.naming.JNDIView.getHAJndiAttributes(JNDIView.java:836)
             at org.jboss.naming.JNDIView.getHAUrl(JNDIView.java:811)
             at org.jboss.naming.JNDIView.list(JNDIView.java:193)
             at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
             at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
             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:155)
             at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
             at org.jboss.mx.interceptor.AbstractInterceptor.invoke(AbstractInterceptor.java:133)
             at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
             at org.jboss.mx.interceptor.ModelMBeanOperationInterceptor.invoke(ModelMBeanOperationInterceptor.java:142)
             at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
             at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
             at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
             at org.jboss.jmx.adaptor.control.Server.invokeOpByName(Server.java:258)
             at org.jboss.jmx.adaptor.html.HtmlAdaptorServlet.invokeOpByName(HtmlAdaptorServlet.java:287)
             at org.jboss.jmx.adaptor.html.HtmlAdaptorServlet.processRequest(HtmlAdaptorServlet.java:102)
             at org.jboss.jmx.adaptor.html.HtmlAdaptorServlet.doGet(HtmlAdaptorServlet.java:77)
             at javax.servlet.http.HttpServlet.service(HttpServlet.java:697)
             at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
             at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
             at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
             at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
             at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
             at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
             at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
             at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
             at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:175)
             at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:74)
             at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
             at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
             at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
             at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
             at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)
             at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java
            :664)
             at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
             at org.apache.tomcat.util.net.MasterSlaveWorkerThread.run(MasterSlaveWorkerThread.java:112)
             at java.lang.Thread.run(Thread.java:595)

            (An annoyance that should be fixed), then displays a reasonable JNDI tree:
            java: Namespace
             +- XAConnectionFactory (class: org.jboss.mq.SpyXAConnectionFactory)
             +- DefaultDS (class: org.jboss.resource.adapter.jdbc.WrapperDataSource)
             +- SecurityProxyFactory (class: org.jboss.security.SubjectSecurityProxyFactory)
             +- WSMQJms (class: org.jboss.resource.adapter.jms.JmsConnectionFactoryImpl)
             +- DefaultJMSProvider (class: org.jboss.jms.jndi.JNDIProviderAdapter)
             +- WSMQJMSProvider (class: org.jboss.jms.jndi.JNDIProviderAdapter)
             +- comp (class: javax.naming.Context)
             +- JmsXA (class: org.jboss.resource.adapter.jms.JmsConnectionFactoryImpl)
             +- ConnectionFactory (class: org.jboss.mq.SpyConnectionFactory)
             +- jaas (class: javax.naming.Context)
             | +- other (class: org.jboss.security.plugins.SecurityDomainContext)
             | +- HsqlDbRealm (class: org.jboss.security.plugins.SecurityDomainContext)
             | +- jbossmq (class: org.jboss.security.plugins.SecurityDomainContext)
             | +- JmsXARealm (class: org.jboss.security.plugins.SecurityDomainContext)
             +- timedCacheFactory (class: javax.naming.Context)
            Failed to lookup: timedCacheFactory, errmsg=org.jboss.util.TimedCachePolicy
             +- TransactionPropagationContextExporter (class: org.jboss.tm.TransactionPropagationContextFactory)
             +- StdJMSPool (class: org.jboss.jms.asf.StdServerSessionPoolFactory)
             +- TransactionPropagationContextImporter (class: org.jboss.tm.TransactionPropagationContextImporter)
             +- TransactionManager (class: org.jboss.tm.TxManager)
            
            Global JNDI Namespace
             +- XAConnectionFactory (class: org.jboss.mq.SpyXAConnectionFactory)
             +- WSMQQueueConnectionFactory (class: com.ibm.mq.jms.MQQueueConnectionFactory)
             +- wsmq (class: org.jnp.interfaces.NamingContext)
             | +- ResponseQueue (class: com.ibm.mq.jms.MQQueue)
             | +- RequestQueue (class: com.ibm.mq.jms.MQQueue)
             +- TopicConnectionFactory (class: org.jboss.naming.LinkRefPair)
             +- EventDispatcher (class: org.jboss.ws.eventing.mgmt.DispatcherDelegate)
             +- UserTransactionSessionFactory (proxy: $Proxy35 implements interface org.jboss.tm.usertx.interfaces.UserTransactionSessionFactory)
             +- UIL2ConnectionFactory[link -> ConnectionFactory] (class: javax.naming.LinkRef)
             +- UIL2XAConnectionFactory[link -> XAConnectionFactory] (class: javax.naming.LinkRef)
             +- QueueConnectionFactory (class: org.jboss.naming.LinkRefPair)
             +- queue (class: org.jnp.interfaces.NamingContext)
             | +- ResponseQueue (class: org.jboss.mq.SpyQueue)
             | +- RequestQueue (class: org.jboss.mq.SpyQueue)
             | +- DLQ (class: org.jboss.mq.SpyQueue)
             +- ConnectionFactory (class: org.jboss.mq.SpyConnectionFactory)
             +- UserTransaction (class: org.jboss.tm.usertx.client.ClientUserTransaction)
             +- jmx (class: org.jnp.interfaces.NamingContext)
             | +- invoker (class: org.jnp.interfaces.NamingContext)
             | | +- RMIAdaptor (proxy: $Proxy29 implements interface org.jboss.jmx.adaptor.rmi.RMIAdaptor,interface org.jboss.jmx.adaptor.rmi.RMIAdaptorExt)
             | +- rmi (class: org.jnp.interfaces.NamingContext)
             | | +- RMIAdaptor[link -> jmx/invoker/RMIAdaptor] (class: javax.naming.LinkRef)
             +- UILXAConnectionFactory[link -> XAConnectionFactory] (class: javax.naming.LinkRef)
             +- UILConnectionFactory[link -> ConnectionFactory] (class: javax.naming.LinkRef)

            Now, here's the fun part. Deploying the MDB provokes the following:
            INFO [EjbModule] Deploying WSMQMDB
            WARN [JMSContainerInvoker] JMS provider failure detected for WSMQMDB
            org.jboss.deployment.DeploymentException: Error during queue setup; - nested throwable: (java.lang.ClassCastException: o
            rg.jboss.resource.adapter.jms.JmsConnectionFactoryImpl)
             at org.jboss.deployment.DeploymentException.rethrowAsDeploymentException(DeploymentException.java:53)
             at org.jboss.ejb.plugins.jms.JMSContainerInvoker.innerStartDelivery(JMSContainerInvoker.java:811)
             at org.jboss.ejb.plugins.jms.JMSContainerInvoker.startService(JMSContainerInvoker.java:839)
            ...

            The key settings are in the -ds.xml <connection-factories> tag:
            <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>
             <!-- The queue connection factory -->
             <attribute name="QueueFactoryRef">WSMQQueueConnectionFactory</attribute>
             <!-- The topic factory -->
             <attribute name="TopicFactoryRef">WSMQTopicConnectionFactory</attribute>
             </mbean>
            
             <no-tx-connection-factory>
             <jndi-name>WSMQJms</jndi-name>
             <rar-name>jms-ra.rar</rar-name> <!-- JCA 1.5 -->
             <use-java-context>true</use-java-context>
             <connection-definition>org.jboss.resource.adapter.jms.JmsConnectionFactory</connection-definition>
             <!-- ClassCastException: org.jboss.resource.adapter.jms.JmsConnectionFactoryImpl -->
             <max-pool-size>20</max-pool-size>
             <!-- These are JBoss-specific properties for a ManagedConnectionFactory -->
             <!-- MUST MATCH Mbean JNDI NAME (overrides default "java:/DefaultJMSProvider") -->
             <config-property name="JmsProviderAdapterJNDI" type="java.lang.String">WSMQJMSProvider</config-property>
             <config-property name="SessionDefaultType" type="java.lang.String">javax.jms.Queue</config-property>
             <config-property name="UserName" type="java.lang.String">User</config-property>
             <config-property name="Password" type="java.lang.String">password</config-property>
             </no-tx-connection-factory>

            Looks like the JmsConnectionFactoryImpl class _does_ exist in the jms-ra.jar deployed inside the jms-ra.rar.

            Any ideas why the ClassCastException is happening?