使用JMS事务时出错 - javax.jms.IllegalStateException:会话已关闭

时间:2013-05-02 18:27:14

标签: java jms mule

我正在使用JMS Polling使用以下代码每5分钟轮询一次JMS队列。在下面的代码中,我将轮询频率设置为1分钟进行测试。轮询工作正常,但它在日志中抛出异常。我无法弄清楚为什么这样做。试图通过改变一些设置来玩,但无法弄清楚。

请帮我解决这个问题。

<jms:connector name="jmsConnector" jndiInitialFactory="${jndi.initialFactoryClass}" connectionFactoryJndiName="${jndi.connectionFactoryName}"
        jndiProviderUrl="${jms.brokerURL}" username="${jms.username}" password="${jms.password}" persistentDelivery="true" maxRedelivery="2" 
        numberOfConcurrentTransactedReceivers="5" disableTemporaryReplyToDestinations="true" specification="1.1" />

<service-overrides transactedMessageReceiver="com.mulesoft.mule.transport.jms.TransactedPollingJmsMessageReceiver"/>

<jms:inbound-endpoint queue="${JMS_QUEUE}" exchange-pattern="one-way">
    <jms:transaction action="ALWAYS_BEGIN"/>
    <properties>
         <spring:entry key="pollingFrequency" value="60000" />
    </properties>
</jms:inbound-endpoint>

轮询工作正常,但它在日志中抛出异常:

WARN  2013-05-02 10:33:05,072 [jmsConnector.receiver.03] com.mulesoft.mule.transport.jms.TransactedPollingJmsMessageReceiver: Error in TX notification handler.
javax.jms.IllegalStateException: The session is closed.
    at progress.message.jimpl.Session.getJMSObjectClosedException(Session.java:3341)
    at progress.message.jimpl.Session.rollback(Session.java:1499)
    at com.mulesoft.mule.transport.jms.TransactedPollingJmsMessageReceiver$2.onNotification(TransactedPollingJmsMessageReceiver.java:323)
    at com.mulesoft.mule.transport.jms.TransactedPollingJmsMessageReceiver$2.onNotification(TransactedPollingJmsMessageReceiver.java:298)
    at org.mule.context.notification.Sender.dispatch(Sender.java:40)
    at org.mule.context.notification.Policy.dispatch(Policy.java:122)
    at org.mule.context.notification.ServerNotificationManager.notifyListeners(ServerNotificationManager.java:249)
    at org.mule.context.notification.ServerNotificationManager.fireNotification(ServerNotificationManager.java:200)
    at org.mule.DefaultMuleContext.fireNotification(DefaultMuleContext.java:435)
    at org.mule.transaction.AbstractTransaction.fireNotification(AbstractTransaction.java:144)
    at org.mule.transaction.AbstractTransaction.rollback(AbstractTransaction.java:98)
    at org.mule.transaction.AbstractSingleResourceTransaction.rollback(AbstractSingleResourceTransaction.java:85)
    at org.mule.transaction.TransactionCoordination.resolveTransaction(TransactionCoordination.java:214)
    at org.mule.execution.BeginAndResolveTransactionInterceptor.resolveTransactionIfRequired(BeginAndResolveTransactionInterceptor.java:77)
    at org.mule.execution.BeginAndResolveTransactionInterceptor.execute(BeginAndResolveTransactionInterceptor.java:59)
    at org.mule.execution.ResolvePreviousTransactionInterceptor.execute(ResolvePreviousTransactionInterceptor.java:48)
    at org.mule.execution.SuspendXaTransactionInterceptor.execute(SuspendXaTransactionInterceptor.java:54)
    at org.mule.execution.ValidateTransactionalStateInterceptor.execute(ValidateTransactionalStateInterceptor.java:44)
    at org.mule.execution.IsolateCurrentTransactionInterceptor.execute(IsolateCurrentTransactionInterceptor.java:44)
    at org.mule.execution.ExternalTransactionInterceptor.execute(ExternalTransactionInterceptor.java:52)
    at org.mule.execution.RethrowExceptionInterceptor.execute(RethrowExceptionInterceptor.java:32)
    at org.mule.execution.RethrowExceptionInterceptor.execute(RethrowExceptionInterceptor.java:17)
    at org.mule.execution.TransactionalErrorHandlingExecutionTemplate.execute(TransactionalErrorHandlingExecutionTemplate.java:113)
    at org.mule.execution.TransactionalErrorHandlingExecutionTemplate.execute(TransactionalErrorHandlingExecutionTemplate.java:34)
    at com.mulesoft.mule.transport.jms.TransactedPollingJmsMessageReceiver.poll(TransactedPollingJmsMessageReceiver.java:110)
    at org.mule.transport.AbstractPollingMessageReceiver.performPoll(AbstractPollingMessageReceiver.java:219)
    at org.mule.transport.PollingReceiverWorker.poll(PollingReceiverWorker.java:84)
    at org.mule.transport.PollingReceiverWorker.run(PollingReceiverWorker.java:53)
    at org.mule.work.WorkerContext.run(WorkerContext.java:311)
    at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
    at java.lang.Thread.run(Unknown Source)

请帮助我调查此问题。

维杰

1 个答案:

答案 0 :(得分:1)

这是一个警告而不是错误:虽然有点可怕,但就Mule而言,这并不是一个错误。也许Progress JMS客户端有点挑剔,其行为与其他JMS客户端的行为不同,但Mule并没有报告错误,所以它不会影响您的应用程序。

我建议你打开一个JIRA,所以MuleSoft可以调查这个问题,也许可以添加对这个特定JMS客户端的支持。