4 Replies Latest reply on Mar 1, 2011 12:56 PM by clauritsen

    XAResource Recovery with Websphere MQ and Oracle

    clauritsen

      Has anyone been able to get XAResource recovery to work between JBoss 5.1.0.GA, Oracle 11.1.0 and Websphere MQ 7.0.1.0?

      I am using the transaction manager configured in the JBossAS 5.1.0.GA distribution.

       

      I'm basically following the wiki article UsingWebSphereMQSeriesWithJBossASPart4

       

      I've registered a connection factory in wmq.jmsra-ds.xml:

      <tx-connection-factory> 

              <track-connection-by-tx/>

              <application-managed-security/>

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

            <xa-transaction></xa-transaction>

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

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

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

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

            <config-property name="userName" type="java.lang.String">mqm</config-property>

            <config-property name="password" type="java.lang.String">xxxx</config-property>

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

            <config-property name="xaEnabled" type="java.lang.String">true</config-property>

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

            <max-pool-size>20</max-pool-size>

      </tx-connection-factory>

       

      Not sure if this is appropriate, but in a desperate move to enable recovery, I also setup in that same file a JMS provider referencing it:

       

       

           <mbean code="org.jboss.jms.jndi.JMSProviderLoader"

                  name="jboss.mq:service=JMSProviderLoader,name=WMQJMSProvider">

             <attribute name="ProviderAdapterClass">org.jboss.jms.jndi.JNDIProviderAdapter</attribute>

             <attribute name="ProviderName">WMQJMSProvider</attribute>

             <attribute name="FactoryRef">java:/wmqcf</attribute>

              <attribute name="QueueFactoryRef">java:/wmqcf</attribute>

             <attribute name="TopicFactoryRef">java:/wmqcf</attribute>

          </mbean>

       

       

      Then I added this line to jbossts-properties.xml:

       

         <property name="com.arjuna.ats.jta.recovery.XAResourceRecovery.WMQ1"

                 value="org.jboss.jms.server.recovery.MessagingXAResourceRecovery;java:/WMQJMSProvider"/>

       

      I started my  JBoss instance and put it under load so it's constantly processing messages from MQ via an MDB configured with the wmq.jmsra.rar ResourceAdapter. Then while it's working hard, I kill the JBoss server, which often leaves in-doubt transactions in oracle:pending.PNG

       

       

      and corresponding ones in WMQ:

      pending2.PNG

       

      and JBoss transaction manager has corresponding files:

       

      $ find data/tx-object-store/ -type f

      data/tx-object-store/HashedActionStore/defaultStore/StateManager/BasicAction/TwoPhaseCoordinator/AtomicAction/#183#/a1484b5_d31b_4d6c13c4_4974a

      data/tx-object-store/HashedActionStore/defaultStore/StateManager/BasicAction/TwoPhaseCoordinator/AtomicAction/#195#/a1484b5_d31b_4d6c13c4_49746

      data/tx-object-store/HashedActionStore/defaultStore/StateManager/BasicAction/TwoPhaseCoordinator/AtomicAction/#216#/a1484b5_d31b_4d6c13c4_4972b

      data/tx-object-store/HashedActionStore/defaultStore/StateManager/BasicAction/TwoPhaseCoordinator/AtomicAction/#225#/a1484b5_d31b_4d6c13c4_49720

      data/tx-object-store/HashedActionStore/defaultStore/StateManager/BasicAction/TwoPhaseCoordinator/AtomicAction/#240#/a1484b5_d31b_4d6c13c4_49733

      data/tx-object-store/HashedActionStore/defaultStore/StateManager/BasicAction/TwoPhaseCoordinator/AtomicAction/#49#/a1484b5_d31b_4d6c13c4_496f0

      data/tx-object-store/HashedActionStore/defaultStore/StateManager/BasicAction/TwoPhaseCoordinator/AtomicAction/#65#/a1484b5_d627_4d6c1d34_132a5

      data/tx-object-store/HashedActionStore/defaultStore/StateManager/BasicAction/TwoPhaseCoordinator/AtomicAction/#90#/a1484b5_d31b_4d6c13c4_496a9

       

      Whenever JBoss attempts to recover the in-doubt transactions, it complains:

       

      java.lang.ClassCastException: Object at 'java:/wmqcf' in context {java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory, java.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces:org.jboss.naming:org.jnp.interfaces} is not an instance of [class=javax.jms.XAConnectionFactory classloader=BaseClassLoader@48433545{vfsfile:/C:/pnp/JavaPrograms/jboss-5.1.0.GA/server/pnpd5/conf/jboss-service.xml} interfaces={}] object class is [class=com.ibm.mq.connector.outbound.ConnectionFactoryImpl classloader=BaseClassLoader@70e443f{vfszip:/C:/pnp/JavaPrograms/jboss-5.1.0.GA/server/pnpd5/deploy/wmq.jmsra.rar/} interfaces={interface=javax.jms.ConnectionFactory classloader=BaseClassLoader@48433545{vfsfile:/C:/pnp/JavaPrograms/jboss-5.1.0.GA/server/pnpd5/conf/jboss-service.xml}, interface=java.io.Serializable classloader=null, interface=javax.resource.Referenceable classloader=BaseClassLoader@48433545{vfsfile:/C:/pnp/JavaPrograms/jboss-5.1.0.GA/server/pnpd5/conf/jboss-service.xml}}]

       

       

      And of course, simply changing the connection-definition to javax.jms.XAConnectionFactory causes the -ds.xml deployment to fail altogether:

       

      Deployment "vfsfile:/C:/pnp/JavaPrograms/jboss-5.1.0.GA/server/pnpd5/deploy/wmq.jmsra-ds.xml" is in error due to the following reason(s): org.jboss.deployers.spi.DeploymentException: ConnectionDefinition 'null' not found in rar 'null'

       

      If I don't include the  com.arjuna.ats.jta.recovery.XAResourceRecovery.WMQ1 property in the jbossts-properties.xml, I get an exception every 2 minutes as the recovery manager tries to recover the transactions referenced in the tx-object-store.

       

      Am I missing something, or is recovery just not possible?

      What are the hazards of intervening manually using rsvmqtrn in WMQ and rollback force 'xx.xx.xx' in oracle?

       

      Thanks for your attention.

        • 1. XAResource Recovery with Websphere MQ and Oracle
          mmusgrov

          This question came up on the ibm developer works forum. The solution there was to replace ConnectionFactory with a QueueConnectionFactory:

           

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

          • 2. Re: XAResource Recovery with Websphere MQ and Oracle
            clauritsen

            Michael,

             

            Thanks for your reply.

             

            Do you happen to have a URL to the IBM forums you mentioned?

             

            I changed javax.jms.ConnectionFactory to javax.jms.QueueConnectionFactory. A similar error occurs when recovery is attempted:

             

            10:34:50,305 ERROR [MessagingXAResourceWrapper] ********************************Failed to connect to server

            java.lang.ClassCastException: Object at 'java:/wmqcf' in context {java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory, java.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces:org.jboss.naming:org.jnp.interfaces} is not an instance of [class=javax.jms.XAConnectionFactory classloader=BaseClassLoader@26e7127{vfsfile:/C:/pnp/JavaPrograms/jboss-5.1.0.GA/server/pnpd5/conf/jboss-service.xml} interfaces={}] object class is [class=com.ibm.mq.connector.outbound.QueueConnectionFactoryImpl classloader=BaseClassLoader@876e4b8{vfszip:/C:/pnp/JavaPrograms/jboss-5.1.0.GA/server/pnpd5/deploy/wmq.jmsra.rar/} interfaces={interface=javax.jms.QueueConnectionFactory classloader=BaseClassLoader@26e7127{vfsfile:/C:/pnp/JavaPrograms/jboss-5.1.0.GA/server/pnpd5/conf/jboss-service.xml}}]

            • 3. XAResource Recovery with Websphere MQ and Oracle
              mmusgrov

              Do you happen to have a URL to the IBM forums you mentioned?

              I googled for com.ibm.mq.connector.outbound.ConnectionFactoryImpl to see what inferaces it implemented and the first hit it came back with (developerWorks: WebSphere: WebSphere: QueueConnectionFactory) seemed to match the description of your issue.

               

              • 4. Re: XAResource Recovery with Websphere MQ and Oracle
                clauritsen

                OK, I think I've gotten myself confused between inbound and outbound. I re-found http://community.jboss.org/thread/153763 and it describes the exact problem I'm having.  In my case, I only have an MDB with and activation spec listening to WMQ--which doesn't need a managed connection factory definition (i.e. in the wqm.jmsra-ds.xml).

                 

                I'm not barred from looking at the sources, like BenR is/was, maybe by delving into it I'll find what I need.