我在 WebSphere 6 中有一个 MDB。MessageListener 链接到 Tibco EMS 队列。在 MDB 中,我尝试写入 WebSphere MQ 队列。我收到以下错误:
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.
QueueConnectionFactory 实例是一个com.ibm.ejs.jms.JMSQueueConnectionFactoryHandle
. 我可以从中获得 XAConnection 吗?我需要吗?如果可能的话,我更愿意使用香草 JMS。
MDB 实现类似于:
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
}