Tôi có MDB trong WebSphere 6. MessageListener được liên kết với hàng đợi Tibco EMS. Trong MDB, tôi đang cố gắng ghi vào hàng đợi WebSphere MQ. Tôi nhận được lỗi sau:Một nỗ lực bất hợp pháp để cam kết một nguồn tài nguyên có khả năng một pha với hai nguồn tài nguyên có sẵn giai đoạn hiện tại
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: [email protected] 3fbe3fbe XAResource: [email protected] enlisted: true mcWrapper.hashCode()1038237154: Vote: commit.
WTRN0089I: [email protected]:4e2e4e2e LocalTransaction:com.ibm.ejs.jms.JMSManagedSession$JMS [email protected] enlisted:true registeredForSynctruemcWrapper.hashcode()1032076676: Vote: none.
Ví dụ QueueConnectionFactory là com.ibm.ejs.jms.JMSQueueConnectionFactoryHandle
. Tôi có thể nhận được một XAConnection từ này? Tôi có cần phải? Tôi muốn ở lại với vanilla JMS nếu có thể.
Việc thực hiện MDB là giống như:
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
}
MQ đã được bật XA. Có vẻ như các trình điều khiển EMS không. [Bật LPS] (https://www.ibm.com/developerworks/wikis/display/xdcomputegrid/Enabling+last+participant+support) đã hoạt động. Cảm ơn bạn. – Synesso
Liên kết để bật LPS được tìm thấy ở đây. http://www-01.ibm.com/support/docview.wss?uid=swg21244805 – asgs