非法尝试将单相资源与现有的两相资源一起提交

发布于 2024-11-26 16:01:56 字数 1757 浏览 1 评论 0原文

我在 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
}

I have an MDB in WebSphere 6. The MessageListener is linked to a Tibco EMS queue. In the MDB I'm 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.

The QueueConnectionFactory instance is a com.ibm.ejs.jms.JMSQueueConnectionFactoryHandle. Could I get an XAConnection from this? Do I need to? I'd prefer to stay with vanilla JMS if possible.

The 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
}

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

可是我不能没有你 2024-12-03 16:01:56

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

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

WTRN0089I:LocalTransactionWrapper@:4e2e4e2e LocalTransaction:com.ibm.ejs.jms.JMSManagedSession$JMS LocalTransaction@4e5a4e5a 已登记: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 已启用”)或 Tibco EMS 连接不支持 XA。如果是后者,并且没有合适的 XA 驱动程序,那么您可以查看 WAS 信息中心中的 Last-Participant 支持,这可能会满足您的需要 - 即 WAS 将准备 WMQ XA 事务,在本地提交 Tibco,然后提交如果 Tibco 提交有效(否则回滚),则为 WMQ。如果 Tibco 连接支持 XA,那么 WAS 就内置了对 WMQ 的完整 XA 支持,因此没有理由不在整个操作中使用两阶段事务。

关于

QueueConnectionFactory 实例是 com.ibm.ejs.jms.JMSQueueConnectionFactoryHandle。我可以从中获得 XAConnection 吗?我需要吗?如果可能的话,我更愿意继续使用普通 JMS。

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

Looking at the error, you have one XA resource and one JCA LocalTransaction

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

and

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

Sounds like you either haven't set the ConnectionFactory to XA enabled, 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 isn't XA capable. If it's the latter, and there is no suitable XA driver, then you could look at Last-Participant support in the WAS infocentre, that might do what you need - i.e. WAS would prepare the WMQ XA transaction, locally commit the Tibco, then commit WMQ if the Tibco commit worked (or rollback otherwise). If the Tibco connection is XA capable, then WAS has full XA support for WMQ built in, so there's no reason not to use a two-phase transaction for the whole operation.

Regarding

The QueueConnectionFactory instance is a com.ibm.ejs.jms.JMSQueueConnectionFactoryHandle. Could I get an XAConnection from this? Do I need to? I'd prefer to stay with vanilla JMS if possible.

You shouldn't do this, just keep to plain JMS. As a general point of style it's better to cast to a ConnectionFactory (not QueueConnectionFactory) too, and then remain with cross-domain objects (Connection, Session, MessageProducer).

把梦留给海 2024-12-03 16:01:56

我有同样的问题。我已经配置了队列、QCF 和 AC,但是在收到消息后,事务正在回滚,并且数据库更新也失败。
我在 onMessage 方法中添加了 @TransactionAttribute(TransactionAttributeType.NOT_SUPPORTED) 。

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

希望它能帮助某人。我的是WAS 7,带有MDB来监听消息。

`

I had the same issue. I have configured my Queue,QCF and AC but after I receive the message the transaction was getting rolled back and DB update also was failing.
I added @TransactionAttribute(TransactionAttributeType.NOT_SUPPORTED)in onMessage method.

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

Hope it helps someone. Mine is WAS 7 with MDB to listen to message.

`

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文