3 Replies Latest reply on Nov 15, 2012 6:32 PM by simondelfab

    Websphere MQ integration

    simondelfab Newbie

      Hi All,

       

      I been trying to get JBoss 7.1.1.Final to connect to Websphere MQ these last couple of days and I encountered an error which I just can't seem to Google myself out of.

       

      The exception I get is this:

       

      com.ibm.msg.client.jms.DetailedJMSException: MQJCA1026: An operation on a domain specific object was not valid. A JMS application attempted to perform an operation on a domain specific object, but the operation is valid only on cross domain objects or in the other messaging domain. Make sure that the JMS objects used by your application are relevant to the required messaging domain.

      16:51:49,818 ERROR [stderr] (http--0.0.0.0-443-1)       at com.ibm.mq.connector.services.JCAExceptionBuilder.buildException(JCAExceptionBuilder.java:141)

       

      A few other people have encountered the same problem:

      https://community.jboss.org/thread/161447

       

      Configure JBoss, I followed:

       

      https://access.redhat.com/knowledge/docs/en-US/JBoss_Enterprise_Application_Platform/6/html/Administration_and_Configuration_Guide/Deploy_the_WebSphere_MQ_Resource_Adapter.html

       

      There is other dated reference sources which I encountered as well:

       

      https://access.redhat.com/knowledge/ja/node/88823

      https://community.jboss.org/wiki/WebsphereMQIntegration

      https://community.jboss.org/wiki/JBossEAP5IntegrationWithWebSphereMQ

       

      My standalone.xml looks like this:

       

              <subsystem xmlns="urn:jboss:domain:resource-adapters:1.0">

                  <resource-adapters>

                      <resource-adapter>

                          <archive>

                              wmq.jmsra.rar

                          </archive>

                          <transaction-support>NoTransaction</transaction-support>

                          <config-property name="traceLevel">

                              8

                          </config-property>

                          <config-property name="traceEnabled">

                              true

                          </config-property>

                          <connection-definitions>

                              <connection-definition class-name="com.ibm.mq.connector.outbound.ManagedQueueConnectionFactoryImpl" jndi-name="TSCF" enabled="true" use-java-context="true" pool-name="TSCF">

                                  <config-property name="port">

                                      1414

                                  </config-property>

                                  <config-property name="username">

                                      root

                                  </config-property>

                                  <config-property name="queueManager">

                                      TSDEV

                                  </config-property>

                                  <config-property name="hostName">

                                      myhost

                                  </config-property>

                                  <config-property name="channel">

                                      some.CHANNEL

                                  </config-property>

                                  <config-property name="password">

                                      mypassword

                                  </config-property>

                                  <config-property name="transportType">

                                      BINDINGS

                                  </config-property>

                              </connection-definition>

                          </connection-definitions>

                          <admin-objects>

                              <admin-object class-name="com.ibm.mq.connector.outbound.MQQueueProxy" jndi-name="QUEUE.NAME" enabled="true" use-java-context="true" pool-name="TSDEV">

                                  <config-property name="baseQueueName">

                                      QUEUE.NAME

                                  </config-property>

                                  <config-property name="baseQueueManagerName">

                                      TSDEV

                                  </config-property>

                              </admin-object>

                        </admin-objects>

                      </resource-adapter>

                      <resource-adapter>

                          <archive>

                              wmq.jmsra.rar

                          </archive>

                          <transaction-support>NoTransaction</transaction-support>

                          <config-property name="traceLevel">

                              8

                          </config-property>

                          <config-property name="traceEnabled">

                              true

                          </config-property>

                          <admin-objects>

                              <admin-object class-name="com.ibm.mq.connector.outbound.MQQueueProxy" jndi-name="LFTLFT" enabled="true" use-java-context="true" pool-name="TSDEV">

                                  <config-property name="baseQueueName">

                                      LFTLFT

                                  </config-property>

                                  <config-property name="baseQueueManagerName">

                                      TSDEV

                                  </config-property>

                              </admin-object>

                          </admin-objects>

                      </resource-adapter>

                </resource-adapters>

        ....

       

      I have tried both CLIENT and BINDINGS transport types.

       

      Side question: the XML schema suggests I can have multiple admin-object elements under admin-objects, but when I do that, JBoss fails to run. Says unexpected element config-property.

       

      I have bumped up the trace level and I have attached the trace file. Apart from the warning "Distributed transactions are not available in client mode.", everything looks to proceeding along normally until the exception.

       

      In regards to the actual exception, the documentation doesn't appear to be helpful:

       

      http://publib.boulder.ibm.com/infocenter/wmqv6/v6r0/index.jsp?topic=%2Fcom.ibm.mq.csqzaw.doc%2Fuj40030_.htm

       

      "Make sure that the JMS objects used by your application are relevant to the required messaging domain."

       

      From my understanding, this means that you should only try to establish a connection to queue/topic using the appropriate connection factories. That is, don't try creating a topic connection to a queue and vice versa. Or use the wrong JMS objects with either a topic or queue connection. I don't believe I am doing that!

       

      Digging down further into the Websphere MQ code, the exception is raised if WASSupport.getEnvironment() returns something != 1. So in the queue connection factory class there is this:

       

      public Connection createConnection(String username, String password)

          throws JMSException

        {

          if (ResourceAdapterImpl.getJCARuntimeHelper().getEnvironment() != 1) {

            return createQueueConnection(username, password);

          }

          throw ((JMSException)JCAExceptionBuilder.buildException(3, "MQJCA1026"));

        }

       

      and in  WASSupport.getEnvironment() there is some reflection going on. But it pretty much always returns 1 (unless it can dynamically load the class com.ibm.ws.util.PlatformHelper and execute some method).

       

      So I am completely stumped as to what the cause of the problem is and I would greatly appreciate any suggestions.

       

      Regards,

      Simon

        • 1. Re: Websphere MQ integration
          simondelfab Newbie

          Problem resolved. The problem was with how the application I am currently supporting is written. The main difference with forum posts I have referenced is that they are using MDBs. In this application it is using plain JMS. It was looking up the connection factory and casting it to javax.jms.ConnectionFactory and then calling createConnection(). Casting to javax.jms.QueueConnectionFactory and calling createQueueConnection() fixed it.

           

          I resolved the "Distributed transactions are not available in client mode." warning by updating wmq.jmsra.rar with the com.ibm.mqetclient.jar. To save other people time, here is the Ant "code" to do this:

           

          <jar destfile="wmq.jmsra.rar" update="true">

                  <fileset file="com.ibm.mqetclient.jar"/>

          </jar>

           

          I am using Websphere 7.0.1 and apparently in future releases, this jar has been included.

           

          Also, to find this jar, it is part of the Websphere Client distribution. On Linux, the rpm: MQSeriesTXClient-7.0.1-0.i386.rpm

          • 2. Re: Websphere MQ integration
            Patrik Varga Newbie

            Hi Simon,

             

             

            about you side question:

            Side question: the XML schema suggests I can have multiple admin-object elements under admin-objects, but when I do that, JBoss fails to run. Says unexpected element config-property.

             

            I had the same "org.jboss.as.connector.util.ParserException: IJ010061: Unexpected element: config-property" exception when trying to setup multiple admin-object elements for queues. It really did not make sense so I started investigating the source code of org.jboss.as.connector.subsystems.resourceadapters.CommonIronJacamarParser, which can be found in JBOSS_HOME/modules/org/jboss/as/connector/main/jboss-as-connector-7.1.2.Final-redhat-1.jar in 7.1.2 Final.

            I noticed that the parseAdminObjects() method is throwing this ParserException in the "case CONFIG_PROPERTY" branch when the local "configMap" used to store config properties already contains the current key, which is the pool-name attribute of the current admin-object element. Using a different pool-name for every admin-object as a workaround seems to solve this problem and you can startup your server.

             

            However I'm not sure if it's correct to do this as the "5.2.1. Resource adapter descriptor" section of the documentation is not totally clear about what is the exact meaning of the pool-name property:

             

            pool-name    Specifies the pool name for the object

             

            (This is actually the documentation in the XML schema at JBOSS_HOME/docs/schema/jboss-as-resource-adapters_1_0.xsd)

             

             

            Hope this helps,

            Patrik

            1 of 1 people found this helpful
            • 3. Re: Websphere MQ integration
              simondelfab Newbie

              Thanks Patrik. That worked. Much appreciated.

               

              I agree the documentation is not entirely clear about the meaning of the pool name. In my sample above I have used the same pool name, thinking it was some top level pool into which the admin object would be stored. But now that you have raised this, I have looked back at other forum posts and noticed that people have specified distinct pool names for each admin object. 

               

              Simon.