You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

ActiveMQ Artemis 2.33与WebSphere JMS连接事务异常求助

ActiveMQ Artemis 2.33与WebSphere集成后事务提交异常问题

环境与问题背景

  • 运行版本:ActiveMQ Artemis 2.33
  • 集成方式:通过JMS及资源适配器与WebSphere完成连接
  • 问题触发:某次部署操作后重启应用及MQ,此后频繁出现事务提交警告

错误日志

2024-05-21 15:40:38,522 WARN  [org.apache.activemq.artemis.core.protocol.openwire.OpenWireConnection] Errors occurred during the buffering operation
javax.jms.IllegalStateException: Transaction not started, XID:[1463898948,globalId=001ffffff8f60ffffffd4ffffffeb4f0002834b37448ffffffa6ffffffc07efffffffe75ffffffa6773a7922ffffffebffffffa9fffffff274ffffff97ffffffe149ffffffebffffffbb,branchId=001ffffff8f60ffffffd4ffffffeb4f0002834b37448ffffffa6ffffffc07efffffffe75ffffffa6773a7922ffffffebffffffa9fffffff274ffffff97ffffffe149ffffffebffffffbb000100000000000002]
    at org.apache.activemq.artemis.core.protocol.openwire.OpenWireConnection$CommandProcessor.processCommit(OpenWireConnection.java:1549) ~[artemis-openwire-protocol-2.33.0.jar:2.33.0]
    at org.apache.activemq.artemis.core.protocol.openwire.OpenWireConnection$CommandProcessor.processCommitTransactionTwoPhase(OpenWireConnection.java:1602) ~[artemis-openwire-protocol-2.33.0.jar:2.33.0]
    at org.apache.activemq.command.TransactionInfo.visit(TransactionInfo.java:102) ~[activemq-client-5.18.3.jar:5.18.3]
    at org.apache.activemq.artemis.core.protocol.openwire.OpenWireConnection.act(OpenWireConnection.java:366) ~[artemis-openwire-protocol-2.33.0.jar:2.33.0]
    at org.apache.activemq.artemis.utils.actors.ThresholdActor.doTask(ThresholdActor.java:68) ~[artemis-commons-2.33.0.jar:2.33.0]
    at org.apache.activemq.artemis.utils.actors.ProcessorBase.executePendingTasks(ProcessorBase.java:68) ~[artemis-commons-2.33.0.jar:2.33.0]
    at org.apache.activemq.artemis.utils.actors.OrderedExecutor.doTask(OrderedExecutor.java:57) ~[artemis-commons-2.33.0.jar:2.33.0]
    at org.apache.activemq.artemis.utils.actors.OrderedExecutor.doTask(OrderedExecutor.java:32) ~[artemis-commons-2.33.0.jar:2.33.0]
    at org.apache.activemq.artemis.utils.actors.ProcessorBase.executePendingTasks(ProcessorBase.java:68) ~[artemis-commons-2.33.0.jar:2.33.0]
    at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) [?:?]
    at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) [?:?]

相关配置

资源适配器配置

failover:(tcp://pro-t24-qve-03:61616,tcp://pro-t24-qve-04:61616)?jms.useAsyncSend=true&jms.alwaysSessionAsync=false&jms.optimizeAcknowledge=true

JMS配置

External initial context factory:
org.apache.activemq.jndi.ActiveMQInitialContextFactory

资源适配器配置截图

WebSphere资源适配器配置截图

问题分析与解决建议

问题根源

错误提示Transaction not started说明WebSphere发起的分布式事务提交请求到达Artemis时,Artemis端没有对应的事务上下文记录。大概率是重启后事务上下文未正确同步,或是连接池、事务资源未彻底清理导致的残留问题。

排查步骤与解决方案

  1. 清理WebSphere连接池残留

    • 登录WebSphere控制台,找到对应JMS连接池,执行强制清除连接操作,避免旧事务关联的连接残留。
    • 检查连接池参数,确保连接超时、最大连接数配置合理,防止连接泄漏。
  2. 重置Artemis事务持久化数据

    • 停止Artemis服务,备份data/journal和data/tx-store目录后删除其中的文件,重启Artemis清除可能损坏的事务元数据。
    • 检查broker.xml中的transaction-timeout配置,确保与WebSphere的事务超时时间一致,避免事务提前被清理。
  3. 调整资源适配器参数

    • 尝试移除jms.optimizeAcknowledge=true参数,该参数在分布式事务场景下可能引发消息确认与事务提交的时序冲突。
    • 添加jms.transactedAcknowledge=true参数,确保消息确认操作与事务绑定。
  4. 校验WebSphere事务配置

    • 检查WebSphere全局事务超时设置,确保其大于业务流程的最长执行时间,避免事务在提交前被主动终止。
    • 确认资源适配器的事务支持设置为XATransaction,保证分布式事务的正确传播。

内容的提问来源于stack exchange,提问作者Albaasith

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.23 20:34:52