XAResource Recovery with Websphere MQ and Oracle
clauritsen Mar 1, 2011 9:39 AMHas 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:
and corresponding ones in WMQ:
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.
-
jbossts-properties.xml 15.6 KB
-
wmq.jmsra-ds.xml 3.0 KB