Illegal attempt to commit a resource with one phase with existing resources with two phases

I have an MDB in WebSphere 6. MessageListener is connected to the Tibco EMS queue. In MDB, I am trying to write to a WebSphere MQ queue. I get the following error:

WMSG0042I: MDB Listener LoanIQ Payments Inbound started successfully for JMSDestination jms/eid/payments WTRN0063E: An illegal attempt to commit a one phase capable resource with existing two phase capable resources has occurred. WTRN0086I: XAException encountered during prepare phase for transaction 00000131...0001. Local resources follow. WTRN0089I: XATransactionWrapper@ 3fbe3fbe XAResource: com.ibm.ejs.jms.JMSManagedSession$JMSXAResource@3fb83fb8 enlisted: true mcWrapper.hashCode()1038237154: Vote: commit. WTRN0089I: LocalTransactionWrapper@ :4e2e4e2e LocalTransaction:com.ibm.ejs.jms.JMSManagedSession$JMS LocalTransaction@4e5a4e5a enlisted:true registeredForSynctruemcWrapper.hashcode()1032076676: Vote: none. 

A QueueConnectionFactory instance is com.ibm.ejs.jms.JMSQueueConnectionFactoryHandle . Can I get an XAConnection from this? Do I need to? I would rather stay with Vanilla JMS if possible.

An MDB implementation is akin to:

 public void onMessage(Message message) { // ^^ incoming message delivered from EMS queue via WAS MessageListener TextMessage textMessage = (TextMessage) message; QueueConnectionFactory factory = (QueueConnectionFactory) context.lookup(factoryName); Queue queue = (Queue) context.lookup(queueName); QueueConnection connection = factory.createQueueConnection(); connection.start(); QueueSession session = connection.createQueueSession(false, QueueSession.AUTO_ACKNOWLEDGE); QueueSender sender = session.createSender(queue); TextMessage message = session.createTextMessage("some new payload"); sender.send(message); // ^^ outgoing message sent to WebSphere MQ queue } 
+6
source share
2 answers

Looking for an error, you have one XA resource and one JCA LocalTransaction

WTRN0089I: XATransactionWrapper @ 3fbe3fbe XAResource: com.ibm.ejs.jms.JMSManagedSession$JMSXAResource@3fb83fb8 credited: true mcWrapper.hashCode () 1038237154: Voting: commit.

and

WTRN0089I: LocalTransactionWrapper @: 4e2e4e2e LocalTransaction: com.ibm.ejs.jms.JMSManagedSession $ JMS LocalTransaction @ 4e5a4e5a credited: true registeredForSynctruemcWrapper.hashcode () 1032076676: Vote: none.

It looks like you either did not install ConnectionFactory in XA, but you see:

http://publib.boulder.ibm.com/infocenter/wasinfo/v6r0/index.jsp?topic=/com.ibm.websphere.nd.doc/info/ae/ae/umj_pjcfm.html

(scroll down to "XA Enabled") or the Tibco EMS connection does not support XA. If this is the last one and there is no suitable XA driver, you can see the Last-Partant support in the WAS info center, which can do what you need - that is, the WAS will prepare the WMQ XA transaction, transmit Tibco locally, and then commit WMQ if the transaction is Tibco works (or rollback otherwise). If the Tibco connection is XA-compliant, WAS has full XA support for embedded WMQ, so there is no reason not to use a two-phase transaction for the entire operation.

Relatively

The QueueConnectionFactory instance is com.ibm.ejs.jms.JMSQueueConnectionFactoryHandle. Can I get an XAConnection from this? Do I need to? I would rather stay with Vanilla JMS if possible.

You should not do this, just stick with a simple JMS. As a general style style, it is best to add to ConnectionFactory (not QueueConnectionFactory) and then stay with cross-domain objects (Connection, Session, MessageProducer).

+7
source

I had the same problem. I set up a turn, QCF and AC, but after I received the message, the transaction rolled back again and the database update also failed. I added the @TransactionAttribute(TransactionAttributeType.NOT_SUPPORTED) method onMessage.

 @TransactionAttribute(TransactionAttributeType.NOT_SUPPORTED) public void onMessage(Message message) {//Logic } 

Hope this helps someone. Mine WAS 7 with MDB to listen to the message.

`

+1
source

Source: https://habr.com/ru/post/893660/


All Articles