2 Replies Latest reply on Jan 4, 2005 8:51 AM by Rune Larsen

    Starting an MDB from IBM MQ (aka. WebSphere MQ aka. MQ Serie

    Rune Larsen Newbie

      I can succesfully send messages from JBoss to an IBM MQ on a remote Queue Manager. But when messaging to JBoss, I cannot get my MDB to work.

      I'm using the JMSAdmin tool from IBM, which binds the IBM MQ and QCF to JBoss' JNDI. All is fine here:

      define ctx(jms)
      change ctx(jms)
      define qcf(qcf) tran(CLIENT) host(MVSPF) port(1415) chan(CLIENT.TO.MQU1) qmgr(MQU1)
      define q(senderQ) queue(JB.ITA.TEST.RESPONSE) qmgr(MQU1)
      define q(incomingQ) queue(JB.ITA.TEST.REQUEST) qmgr(MQU1)


      But JBoss cannot start my MDB. This is what happens:

      16:10:35,553 ERROR [JMSContainerInvoker] 16:20:08,397 INFO [EjbModule] Deploying XMLParserEJB
      port.tcp.TCPTransport.handleMessages(Unknown Source)
       at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(Unknown Source)
       at java.lang.Thread.run(Unknown Source)
      r.java:764)
       at org.jboss.system.ServiceMBeanSupport.jbossInternalStart(ServiceMBeanSupport.java:271)
       at org.jboss.system.ServiceMBeanSupport.jbossInternalLifecycle(ServiceMBeanSupport.java:221)
       at sun.reflect.GeneratedMethodAccessor67.invoke(Unknown Source)
       at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
       at java.lang.reflect.Method.invoke(Unknown Source)
       at org.jboss.mx.server.ReflectedDispatcher.dispatch(ReflectedDispatcher.java:60)
       ... 107 more
      16:20:08,477 ERROR [JMSContainerInvoker] Starting failed jboss.j2ee:service=EJB,plugin=invoker,binding=message-driven-bean,jndiName=local/XMLParserEJB
      java.lang.ClassCastException: com.ibm.mq.jms.MQQueue
       at org.jboss.mq.SpyConnectionConsumer.<init>(SpyConnectionConsumer.java:91)
       at org.jboss.mq.SpyConnection.createConnectionConsumer(SpyConnection.java:166)
       at org.jboss.ejb.plugins.jms.JMSContainerInvoker.innerCreate(JMSContainerInvoker.java:740)
      




      Configuration: JBoss 3.2.6 or 4.0.0 (same result)
      jboss.xml
       <message-driven>
       <ejb-name>XMLParserEJB</ejb-name>
       <destination-jndi-name>jnp://localhost:1099/jms/incomingQ</destination-jndi-name>
       <resource-ref>
       <res-ref-name>jms/qcf</res-ref-name>
       <jndi-name>jnp://localhost:1099/jms/qcf</jndi-name>
       </resource-ref>
       </message-driven>
      


      ejb-jar.xml
      <message-driven>
       <description>Send an XML document, and recieve parsed tokens.</description>
       <display-name>XML Parser</display-name>
       <ejb-name>XMLParserEJB</ejb-name>
       <ejb-class>dk.jyskebank.integration.ejb.XMLParserBean</ejb-class>
       <transaction-type>Container</transaction-type>
       <acknowledge-mode>Auto-acknowledge</acknowledge-mode>
       <message-driven-destination>
       <destination-type>javax.jms.Queue</destination-type>
       <subscription-durability>Durable</subscription-durability>
       </message-driven-destination>
       <resource-ref>
       <res-ref-name>jms/qcf</res-ref-name>
       <res-type>javax.jms.QueueConnectionFactory</res-type>
       <res-auth>Container</res-auth>
       </resource-ref>
       </message-driven>
      


      The presumably useful link that everybody keeps posting, and which is also present in the JBoss documentation chapter 6 is dead:
      http://sourceforge.net/tracker/index.php?func=detail&aid=753022&group_id=22866&atid=376687

      Any help appriciated

        • 2. Re: Starting an MDB from IBM MQ (aka. WebSphere MQ aka. MQ S
          Rune Larsen Newbie

          Found the soluation myself here: http://www.onjava.com/pub/a/onjava/2004/10/13/XMLMessaging.html?page=4

          I needed this MBean:

          <mbean code="org.jboss.jms.jndi.JMSProviderLoader" name="jboss.mq:service=JMSProviderLoader, name=WSMQProvider">
           <attribute name="ProviderName">WSMQProvider</attribute>
           <attribute name="ProviderAdapterClass">org.jboss.jms.jndi.JNDIProviderAdapter</attribute>
           <attribute name="QueueFactoryRef">jms/qcf</attribute>
           <attribute name="TopicFactoryRef">jms/tcf</attribute>
           <attribute name="Properties">
          java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory
          java.naming.provider.url=jnp://127.0.0.1:1099
           </attribute>
           </mbean>


          and some changes to ejb-jar.xml:

          <?xml version="1.0"?>
          <!DOCTYPE jboss PUBLIC "-//JBoss//DTD JBOSS 4.0//EN"
           "http://www.jboss.org/j2ee/dtd/jboss_4_0.dtd">
          <jboss>
           <enterprise-beans>
          
           <session>
           <ejb-name>MQSenderEJB</ejb-name>
           <jndi-name>MQSenderEJB</jndi-name>
           </session>
          
           <message-driven>
           <ejb-name>XMLParserEJB</ejb-name>
           <destination-jndi-name>jms/incomingQ</destination-jndi-name>
           <configuration-name>WSMQ Message Driven Bean</configuration-name>
          
           <invoker-bindings>
           <invoker>
           <invoker-proxy-binding-name>wsmq-message-driven-bean</invoker-proxy-binding-name>
           <!-- <jndi-name>jms/incomingQ</jndi-name>-->
           </invoker>
           </invoker-bindings>
           </message-driven>
           </enterprise-beans>
          
           <invoker-proxy-bindings>
           <invoker-proxy-binding>
           <name>wsmq-message-driven-bean</name>
           <invoker-mbean>whatever</invoker-mbean>
           <proxy-factory>org.jboss.ejb.plugins.jms.JMSContainerInvoker</proxy-factory>
           <proxy-factory-config>
           <JMSProviderAdapterJNDI>WSMQProvider</JMSProviderAdapterJNDI>
           <ServerSessionPoolFactoryJNDI>StdJMSPool</ServerSessionPoolFactoryJNDI>
           <MaximumSize>15</MaximumSize>
           <MaxMessages>1</MaxMessages>
           <MDBConfig>
           <ReconnectIntervalSec>10</ReconnectIntervalSec>
           <DLQConfig>
           <DestinationQueue>jms/incomingQ</DestinationQueue>
           <MaxTimesRedelivered>10</MaxTimesRedelivered>
           <TimeToLive>0</TimeToLive>
           </DLQConfig>
           </MDBConfig>
           </proxy-factory-config>
           </invoker-proxy-binding>
           </invoker-proxy-bindings>
          
           <container-configurations>
           <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>
           </container-configurations>
          </jboss>