非法尝试使用现有的两阶段资源提交具有单阶段功能的资源

Syn*_*sso 6 websphere jms xa message-driven-bean ibm-mq

我在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.
Run Code Online (Sandbox Code Playgroud)

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
}
Run Code Online (Sandbox Code Playgroud)

str*_*mqm 7

查看错误,您有一个XA资源和一个JCA LocalTransaction

WTRN0089I:XATransactionWrapper @ 3fbe3fbe XAResource:com.ibm.ejs.jms.JMSManagedSession$JMSXAResource@3fb83fb8 enlisted:true mcWrapper.hashCode()1038237154:投票:提交.

WTRN0089I:LocalTransactionWrapper @:4e2e4e2e LocalTransaction:com.ibm.ejs.jms.JMSManagedSession $ JMS LocalTransaction @ 4e5a4e5a enlisted:true registeredForSynctruemcWrapper.hashcode()1032076676:投票:无.

听起来你没有将ConnectionFactory设置为启用XA,请参阅:

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

(向下滚动到"XA Enabled")或Tibco EMS连接不支持XA.如果是后者,并且没有合适的XA驱动程序,那么您可以查看WAS infocentre中的Last-Participant支持,这可能会满足您的需求 - 即WAS将准备WMQ XA事务,本地提交Tibco,然后提交WMQ如果Tibco提交工作(否则回滚).如果Tibco连接具有XA功能,那么WAS对内置的WMQ具有完全的XA支持,因此没有理由不对整个操作使用两阶段事务.

关于

QueueConnectionFactory实例是com.ibm.ejs.jms.JMSQueueConnectionFactoryHandle.我可以从中获得XAConnection吗?我需要吗?如果可能的话,我宁愿和香草JMS呆在一起.

你不应该这样做,只需保持简单的JMS.作为一般的风格点,最好也可以转换为ConnectionFactory(而不是QueueConnectionFactory),然后保留跨域对象(Connection,Session,MessageProducer).

  • MQ已启用XA.似乎EMS司机不是.[启用LPS](https://www.ibm.com/developerworks/wikis/display/xdcomputegrid/Enabling+last+participant+support)工作.谢谢. (2认同)