10 Replies Latest reply on Sep 20, 2010 5:02 PM by Jaswinder Singh

    Failed Attempt to integrate JBOSS AS with Websphere MQ

    Jeremy O'Donohue Newbie

      Hello people,

      Looking for some assistance with integrating WSMQ with JBOSS 5 GA,

       

      Here is the problem:

       

      Attempts to integrate JBOSS AS with Websphere MQ

      Versions and Operating Systems:

      Machine 1: (172.19.1.4)

      ·         Red Hat Enterprise Linux Server release 5.4 (Tikanga)

      ·         JBOSS-5.1.0

      Machine 2: (172.19.1.14)

      ·         Windows Server 2003 R2 Standard Edition

      ·         IBM Websphere MQ 7 (Trial)

      Articles Followed / Resourced:

      ·         http://community.jboss.org/wiki/JBossEAP5IntegrationwithWebSphereMQ

      ·         http://publib.boulder.ibm.com/infocenter/wmqv6/v6r0/index.jsp?topic=/com.ibm.mq.csqzaw.doc/uj40010_.htm

      ·         http://community.jboss.org/wiki/UsingWebSphereMQSeriesWithJBossAsPart4

      ·         http://www-01.ibm.com/support/docview.wss?rs=171&context=SSFKSJ&dc=DA400&uid=swg27009524&loc=en_US&cs=UTF-8&lang=en&rss=ct171websphere

      Procedure Followed:

      Define Test Queue Manager and test Queues in Websphere MQ as detailed below:

      Queue Manager: ExampleQM

      Queue:TEST.QUEUE

       

      Install the Websphere MQ resource adapter (wmq.jmsra.rar) in JBOSS

       

      Define Connection Factory wmqcf-ds.xml in JBOSS JNDI as :

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

      <connection-factories>

          <tx-connection-factory>

              <jndi-name>wmqcf</jndi-name>

              <rar-name>wmq.jmsra.rar</rar-name>

              <use-java-context>true</use-java-context>

              <connection-definition>javax.jms.ConnectionFactory</connection-definition>

              <jmx-invoker-name>jboss:service=invoker,type=jrmp</jmx-invoker-name>

              <min-pool-size>0</min-pool-size>

              <max-pool-size>10</max-pool-size>

              <blocking-timeout-millis>30000</blocking-timeout-millis>

              <idle-timeout-minutes>30</idle-timeout-minutes>

              <prefill>false</prefill>

              <background-validation>false</background-validation>

              <background-validation-millis>0</background-validation-millis>

              <validate-on-match>true</validate-on-match>

              <statistics-formatter>org.jboss.resource.statistic.pool.JBossDefaultSubPoolStatisticFormatter</statistics-formatter>

              <isSameRM-override-value>false</isSameRM-override-value>

              <allocation-retry>0</allocation-retry>

              <allocation-retry-wait-millis>5000</allocation-retry-wait-millis>

              <config-property type="java.lang.String" name="channel">SYSTEM.DEF.SVRCONN</config-property>

              <config-property type="java.lang.String" name="hostName">172.19.1.14</config-property>

              <config-property type="java.lang.String" name="port">1414</config-property>

              <config-property type="java.lang.String" name="queueManager">ExampleQM</config-property>

              <config-property type="java.lang.String" name="transportType">CLIENT</config-property>

              <application-managed-security xsi:type="securityMetaData" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">JmsXARealm</application-managed-security>

              <metadata/>

              <xa-resource-timeout>0</xa-resource-timeout>

              <xa-transaction/>

          </tx-connection-factory>

      </connection-factories>

       

      Define Destination QUEUE wmq.jmsra-ds.xml as:

      <connection-factories>

      <mbean code="org.jboss.resource.deployment.AdminObject"

            name="jca.wmq:name=ivtqueue">

          <!-- Bind this AdminObject  with the JNDI name IVTQueue -->

          <attribute name="JNDIName">IVTQueue</attribute>

       

          <!-- this MBean depends on the WebSphere MQ resource adapter -->

          <depends optional-attribute-name="RARName">jboss.jca:service=RARDeployment,name='wmq.jmsra.rar'</depends>

          <!-- this admin object is a javax.jms.Queue -->

          <attribute name="Type">javax.jms.Queue</attribute>

          <!--

             Configuration for Queue TEST.QUEUE on queue manager ExampleQM. All messages sent

             to this queue will have their expiry time overridden so that messages never expire

          -->

          <attribute name="Properties">

            baseQueueManagerName=ExampleQM

            baseQueueName=TEST.QUEUE

          </attribute>

        </mbean>

      </connection-factories>

       

      Attempt to deploy simple test EJB3 Message Driven Bean to listen for messages arriving on queue defined in JNDI as IVTQueue which references MQ Queue TEST.QUEUE:

      package au.com.loftusit.mqtest;

       

      import java.util.logging.Level;

      import java.util.logging.Logger;

       

      import javax.jms.Message;

      import javax.jms.MessageListener;

      import javax.ejb.MessageDriven;

      import javax.ejb.ActivationConfigProperty;

      import org.jboss.annotation.ejb.ResourceAdapter;

       

      public @MessageDriven(name = "testbean", activationConfig = {

                  @ActivationConfigProperty(propertyName = "destinationType", propertyValue = "javax.jms.Queue"),

              @ActivationConfigProperty(propertyName = "destination", propertyValue = "IVTQueue")})

      @ResourceAdapter("wmq.jmsra.rar")

      class WMQMDBTest implements MessageListener {

       

          private static final Logger LOGGER = Logger.getLogger(WMQMDBTest.class

                  .toString());

       

          public void onMessage(Message message) {

              LOGGER.log(Level.INFO, message.toString());

          }

       

      }

       

      Problem

      When deploying Message Driven Bean detailed above we run into class cast exception errors receive the following errors in the JBOSS Log:

      14:50:14,555 WARN  [JmsActivation] Failure in jms activation org.jboss.resource.adapter.jms.inflow.JmsActivationSpec@855d52(ra=org.jboss.resource.adapter.jms.JmsResourceAdapter@6cad07 destination=IVTQueue destinationType=null tx=true durable=false reconnect=10 provider=java:/DefaultJMSProvider user=null maxMessages=1 minSession=1 maxSession=15 keepAlive=60000 useDLQ=true DLQHandler=org.jboss.resource.adapter.jms.inflow.dlq.GenericDLQHandler DLQJndiName=queue/DLQ DLQUser=null DLQMaxResent=5)

      java.lang.ClassCastException: com.ibm.mq.jms.MQQueue cannot be cast to org.jboss.jms.destination.JBossDestination

              at org.jboss.jms.client.container.SessionAspect.handleCreateConnectionConsumer(SessionAspect.java:766)

              at org.jboss.aop.advice.org.jboss.jms.client.container.SessionAspect_z_handleCreateConnectionConsumer_28121199.invoke(SessionAspect_z_handleCreateConnectionConsumer_28121199.java)

              at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)

              at org.jboss.jms.client.container.ClosedInterceptor.invoke(ClosedInterceptor.java:170)

              at org.jboss.aop.advice.PerInstanceInterceptor.invoke(PerInstanceInterceptor.java:86)

              at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)

              at org.jboss.jms.client.delegate.ClientConnectionDelegate.createConnectionConsumer(ClientConnectionDelegate.java)

              at org.jboss.jms.client.JBossConnection.createConnectionConsumer(JBossConnection.java:140)

              at org.jboss.resource.adapter.jms.inflow.JmsServerSessionPool.setupConsumer(JmsServerSessionPool.java:289)

              at org.jboss.resource.adapter.jms.inflow.JmsServerSessionPool.start(JmsServerSessionPool.java:89)

              at org.jboss.resource.adapter.jms.inflow.JmsActivation.setupSessionPool(JmsActivation.java:656)

              at org.jboss.resource.adapter.jms.inflow.JmsActivation.setup(JmsActivation.java:359)

              at org.jboss.resource.adapter.jms.inflow.JmsActivation$SetupActivation.run(JmsActivation.java:729)

              at org.jboss.resource.work.WorkWrapper.execute(WorkWrapper.java:205)

              at org.jboss.util.threadpool.BasicTaskWrapper.run(BasicTaskWrapper.java:260)

              at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)

              at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)

              at java.lang.Thread.run(Thread.java:619)

       

      Conclusion

      The lack of thorough documentation regarding setting up JCA / JMS /Websphere MQ connections has caused us significant time wastage. We would greatly appreciate a working example using the WS MQ resource Adapter within JBOSS to perform CLIENT POINT to POINT messaging.

      Regards,

       

      Jeremy O'Donohue

      Loftus IT

        • 1. Re: Failed Attempt to integrate JBOSS AS with Websphere MQ
          jaikiran pai Master

          Since you mention that you are using JBoss AS-5, i'll move this out of the (outdated) "MQ" forum into the "JBoss Messaging" forum. AS-5 uses JBoss Messaging.

          • 3. Re: Failed Attempt to integrate JBOSS AS with Websphere MQ
            Ben Cotton Newbie

             

            The problem may be with you MDB's annotation for the "destination" propertyValue.  Your annotation has propertyValue="IVTQueue" (which is the JNDI name).  Try using the value of the actual WSMQ hosted Queue "destination", which for your config would be propertyValue="TEST.QUEUE"

             

            We also had lots of problems getting a JBoss 5 deployed MDB to consume from a WSMQ Destination via the IBM JCA resource adapter.  It took a lot of hacking to get it to work.

             

            Here are some relevant cut-n-pastes from a config that finally worked for us.

             

            1.  From the MDB.java file:

             

            @MessageDriven(activationConfig =

            {

                    @ActivationConfigProperty(propertyName="messagingType",propertyValue="javax.jms.MessageListener"),

                    @ActivationConfigProperty(propertyName = "destinationType",propertyValue = "javax.jms.Queue"),

                    @ActivationConfigProperty(propertyName = "destination", propertyValue = "SYSTEM.DEFAULT.LOCAL.QUEUE"),

                    @ActivationConfigProperty(propertyName = "useJNDI", propertyValue = "false"),

                    @ActivationConfigProperty(propertyName = "channel", propertyValue = "SYSTEM.DEF.SVRCONN"),

                    @ActivationConfigProperty(propertyName = "hostName", propertyValue = "10.9.60.107"), /*  NYFILBB07945.AUR.LEHMAN.COM */

                    @ActivationConfigProperty(propertyName = "queueManager", propertyValue = "CapMktsQM"),

                    @ActivationConfigProperty(propertyName = "port", propertyValue = "1414"),

                    @ActivationConfigProperty(propertyName = "transportType", propertyValue = "CLIENT")

             

                        

            })

            @TransactionAttribute(TransactionAttributeType.NOT_SUPPORTED)

            @ResourceAdapter(value = "wmq.jmsra.rar")

             

            2.  From the IVTCF-ds.xml file:

             

            <connection-factories>

               <mbean code="org.jboss.resource.deployment.AdminObject" name="jca.wmq:name=IVTQueue">

                  

                   <attribute name="JNDIName">IVTQueue</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=CapMktsQM

                        baseQueueName=SYSTEM.DEFAULT.LOCAL.QUEUE </attribute>

                      

               </mbean>


               <tx-connection-factory>

                   <jndi-name>IVTCF</jndi-name>

                   <xa-transaction/>

                   <rar-name>wmq.jmsra.rar</rar-name>

                   <use-java-context>false</use-java-context>

                   <connection-definition>javax.jms.ConnectionFactory</connection-definition>

                   <jmx-invoker-name>jboss:service=invoker,type=jrmp</jmx-invoker-name>

                   <min-pool-size>1</min-pool-size>

                   <max-pool-size>10</max-pool-size>

                   <blocking-timeout-millis>30000</blocking-timeout-millis>

                   <idle-timeout-minutes>30</idle-timeout-minutes>

                   <prefill>false</prefill>

                   <background-validation>false</background-validation>

                   <background-validation-millis>0</background-validation-millis>

                   <validate-on-match>true</validate-on-match>

                   <statistics-formatter>org.jboss.resource.statistic.pool.JBossDefaultSubPoolStatisticFormatter</statistics-formatter>

                   <isSameRM-override-value>false</isSameRM-override-value>

                   <allocation-retry>0</allocation-retry>

                   <allocation-retry-wait-millis>5000</allocation-retry-wait-millis>

                   <config-property type="java.lang.String" name="channel">SYSTEM.DEF.SVRCONN</config-property>

                   <config-property type="java.lang.String" name="hostName">10.9.60.107</config-property>

                   <config-property type="java.lang.String" name="port">1414</config-property>

                   <config-property type="java.lang.String" name="queueManager">CapMktsQM</config-property>

                   <config-property type="java.lang.String" name="transportType">CLIENT</config-property>

                   <security-domain-and-application>JmsXARealm</security-domain-and-application>

                   <xa-resource-timeout>0</xa-resource-timeout>

               </tx-connection-factory>

            </connection-factories>
            • 4. Re: Failed Attempt to integrate JBOSS AS with Websphere MQ
              Jeremy O'Donohue Newbie
              Thanks alot, Ill give your config a try when I get back to work on monday.
              • 5. Re: Failed Attempt to integrate JBOSS AS with Websphere MQ
                Jeremy O'Donohue Newbie

                Good Morning Ben,

                 

                Back at work today, had a look at your code snippets, but still run into issues we have seen before:

                 

                Most of the properties you are using in your MDB are rejected on deployment by our JBOSS server:

                Heres the Error:

                Failed to create Resource wmp-mdb-test-v1.jar - cause: java.lang.RuntimeException:org.jboss.deployers.client.spi.IncompleteDeploymentException: Summary of incomplete deployments (SEE PREVIOUS ERRORS FOR DETAILS): DEPLOYMENTS IN ERROR: Deployment "jboss.j2ee:jar=wmp-mdb-test-v1.jar,name=WMQMDBTest,service=EJB3" is in error due to the following reason(s): java.beans.IntrospectionException: No property found for: transportType on JavaBean: org.jboss.resource.adapter.jms.inflow.JmsActivationSpec@9d87a0(ra=null destination=TEST.QUEUE destinationType=null tx=true durable=false reconnect=10 provider=java:/DefaultJMSProvider user=null maxMessages=1 minSession=1 maxSession=15 keepAlive=60000 useDLQ=true DLQHandler=org.jboss.resource.adapter.jms.inflow.dlq.GenericDLQHandler DLQJndiName=queue/DLQ DLQUser=null DLQMaxResent=5) -> org.jboss.deployers.client.spi.IncompleteDeploymentException:Summary of incomplete deployments (SEE PREVIOUS ERRORS FOR DETAILS): DEPLOYMENTS IN ERROR: Deployment "jboss.j2ee:jar=wmp-mdb-test-v1.jar,name=WMQMDBTest,service=EJB3" is in error due to the following reason(s): java.beans.IntrospectionException: No property found for: transportType on JavaBean: org.jboss.resource.adapter.jms.inflow.JmsActivationSpec@9d87a0(ra=null destination=TEST.QUEUE destinationType=null tx=true durable=false reconnect=10 provider=java:/DefaultJMSProvider user=null maxMessages=1 minSession=1 maxSession=15 keepAlive=60000 useDLQ=true DLQHandler=org.jboss.resource.adapter.jms.inflow.dlq.GenericDLQHandler DLQJndiName=queue/DLQ DLQUser=null DLQMaxResent=5)

                 

                I've had a look into this in the past and is seems to happen because there are no getters / setters for some of the properties defined in the MDB ie. hostName in the org.jboss.resource.adapter.jms.inflow.JmsActivationSpec class (http://docs.huihoo.com/javadoc/jboss/4.0.2/org/jboss/resource/adapter/jms/inflow/JmsActivationSpec.java.html).

                 

                Did you have to extend this class to have a successful deployment?

                 

                FYI setting : @ActivationConfigProperty(propertyName = "useJNDI", propertyValue = "false"), allows you to reference the QUEUE by it's WSMQ Name as it tells the MDB to bypass JNDI lookup and go straight to WS.

                 

                My New Test MDB code:

                 

                package au.com.loftusit.mqtest;

                 

                import java.util.logging.Level;

                import java.util.logging.Logger;

                 

                import javax.jms.Message;

                import javax.jms.MessageListener;

                import javax.ejb.ActivationConfigProperty;

                import javax.ejb.MessageDriven;

                import javax.ejb.TransactionAttribute;

                import javax.ejb.TransactionAttributeType;

                 

                import org.jboss.annotation.ejb.ResourceAdapter;

                 

                 

                 

                @MessageDriven(activationConfig =

                {

                        @ActivationConfigProperty(propertyName="messagingType",propertyValue="javax.jms.MessageListener"),

                        @ActivationConfigProperty(propertyName = "destinationType",propertyValue = "javax.jms.Queue"),

                        @ActivationConfigProperty(propertyName = "destination", propertyValue = "TEST.QUEUE"),

                        @ActivationConfigProperty(propertyName = "useJNDI", propertyValue = "false"),

                        @ActivationConfigProperty(propertyName = "channel", propertyValue = "SYSTEM.DEF.SVRCONN"),

                        @ActivationConfigProperty(propertyName = "hostName", propertyValue = "172.19.1.14"),

                        @ActivationConfigProperty(propertyName = "queueManager", propertyValue = "ExampleQM"),

                        @ActivationConfigProperty(propertyName = "port", propertyValue = "1414"),

                        @ActivationConfigProperty(propertyName = "transportType", propertyValue = "CLIENT")

                 

                 

                })

                @TransactionAttribute(TransactionAttributeType.NOT_SUPPORTED)

                @ResourceAdapter(value = "wmq.jmsra.rar")

                class WMQMDBTest implements MessageListener {

                 

                 

                 

                public void onMessage(Message message) {

                        System.out.println(message.toString());

                }

                 

                }

                • 6. Re: Failed Attempt to integrate JBOSS AS with Websphere MQ
                  Ben Cotton Newbie

                  I was able to sucessfully deploy your WMQTestMDB.java MDB to my JBoss AS 5.1  instance and confirm that this MDB executed immediately upon my sending a test message to my WSMQ destination 'TEST.QUEUE'.

                   

                  I did this by doing the following

                   

                  1.  Modify your WMQTestMDB.java source to indicate my WSMQ instance ('hostName' and 'queueManager' property values changed)

                  2.  Build a .jar (file name = JBossMessagingForum.jar) to deploy to my JBoss AS 5.1 instance (this .jar is attached to this post)

                  3.  cp JBossMessagingForum.jar $JBOSS_HOME/server/default/deploy/

                  4.  confirm from the JBoss server log file that the deploy had no errors/exceptions and that EJB 'WMQTestMDB' started

                  5.  From the IBM Websphere MQ Explorer application, right clicked on the 'TEST.QUEUE' object and selected the 'Put Test Message' menu item

                  6.  Sent a "Hello World" text message to TEST.QUEUE

                  7.  Confirmed from the JBoss server log file that the MDB consumed the 'Hello World' message

                   

                  All this worked without error, I am not exactly sure why your MDB deployment did not work for you.

                   

                  As a possible test, maybe you can take the attached .jar and re-try steps 1 through 7 above?

                  • 7. Re: Failed Attempt to integrate JBOSS AS with Websphere MQ
                    Ben Cotton Newbie

                    jeremyojeremy wrote:

                     


                    I've had a look into this in the past and is seems to happen because there are no getters / setters for some of the properties defined in the MDB ie. hostName in the org.jboss.resource.adapter.jms.inflow.JmsActivationSpec class (http://docs.huihoo.com/javadoc/jboss/4.0.2/org/jboss/resource/adapter/jms/inflow/JmsActivationSpec.java.html).

                     

                    Did you have to extend this class to have a successful deployment?

                     


                     

                    No.  I've never seen anything like this re: deploying an MDB to JBoss AS.

                    • 8. Re: Failed Attempt to integrate JBOSS AS with Websphere MQ
                      Ben Cotton Newbie

                      The updated Wiki documentation at http://community.jboss.org/wiki/JBossEAP5IntegrationwithWebSphereMQ has made many *essential* improvements since we hacked our  JBoss to WSMQ (via IBM JCA resource adapter) integration effort last summer.  It still is not 100% complete, and is not yet 100% sound re:  addressing some significant problems that we still experience re: using JBoss JNDI API to operate on JBoss-hosted references that should use the IBM JCA adapter  to bridge to WSMQ implementations of Queue and QueueConnectionFactory ( see http://community.jboss.org/thread/129674 ).   However, there are enough improvements to the updated Wiki documentation that you should be able to easily deploy an EJB3 annotated MDB to JBoss AS 5 and observer that MDB directly consume messages sent to a WSMQ destination.
                      • 9. Re: Failed Attempt to integrate JBOSS AS with Websphere MQ
                        Frank Nillies Newbie

                        Hi,

                         

                        I use JBoss 4.2.2 and Websphere 7 on different servers. My Problem is I do not want to configure the listening MDB using annotations or deployment discriptors (which works well). Is there any way to configure the MDBs using JNDI? Or is it possible to store the ejb-jar.xml or the jboss.xml outside the ear file?

                         

                        Thanks a lot

                        Frank

                        • 10. Re: Failed Attempt to integrate JBOSS AS with Websphere MQ
                          Jaswinder Singh Newbie

                          Same question as Frank's. Any way to keep jboss.xml and ej-jar.xml configurations outside ear file? My application provides other applications an ability to add communication points - and talk to exisitng points (few of the communication end points being propritery).

                          There has to be a mechanism to define and configure listening MDBs. Bean classes already exist that an application can choose from.