【问题标题】:Cannot delist Resource. It is not enlisted for cleanup in the LocalTransactionContainment无法移除资源。它没有在 LocalTransactionContainment 中进行清理
【发布时间】:2015-10-31 01:11:52
【问题描述】:

我有一个单例数据访问类,它在服务启动时初始化。我从 QCF 获得了 QueueConnection,并在初始化时(在构造函数中)存储在 DataAccess 类中。

我对多个传入请求(大约每秒 30 个)使用相同的连接将消息发送到 MQ。我在负载测试时遇到此异常。

WLTC0011E: Cannot delist Resource. It is not enlisted for cleanup in the LocalTransactionContainment.   
J2CA0031I: Method delist caught java.lang.IllegalStateException: Cannot delist Resource. It is not enlisted for cleanup with this LocalTransactionCoordinator.

J2CA0073E: Unable to delist connection from resource JMS$DBQCF1$JMSManagedConnection@9 from transaction in method localTransactionCommitted due to exception. 
           Initiating destruction of connection. Exception is: javax.resource.ResourceException: delist: caught Exception

这是我将消息发送到队列的代码。

public String sendMessage(String reqMsg) throws Exception{
    QueueConnection queueCon = DataAccess.getDataAccess().getQueueCon();
    Queue queue = DataAccess.getDataAccess().getRequestQueue();
    QueueSession session = queueCon.createQueueSession(true,Session.AUTO_ACKNOWLEDGE);
    QueueSender sender = session.createSender(queue);
    TextMessage textMsg = queueSession.createTextMessage();

    textMsg.setText(reqMsg);
    sender.send(textMsg);
    String msgId = textMsg.getJMSMessageID();

    queueSession.commit();

    closeSender(sender);
    closeSession(session);

    return msgId;
}

我尝试搜索此异常,但找不到任何内容。谁能告诉它是什么。?是因为我使用的是单个 QueueConnection 吗?

【问题讨论】:

    标签: java jakarta-ee jms


    【解决方案1】:

    实际上我没有找到这个问题的确切原因,但我通过调整 Create Queue Session 参数解决了这个问题。

    我变了

    QueueSession session = queueCon.createQueueSession(true,Session.AUTO_ACKNOWLEDGE);

    QueueSession session = queueCon.createQueueSession(false, Session.AUTO_ACKNOWLEDGE);
    

    然后删除提交。完成此操作后,我再也没有看到该异常。

    希望这对正在寻找此异常的人有所帮助。

    【讨论】:

      猜你喜欢
      • 2011-03-10
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-10-15
      • 2018-09-13
      • 2017-06-08
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多