4

我的设置是 Spring 3 JMS、MVC + Websphere MQ + Websphere 7

<!-- this is the Message Driven POJO (MDP) -->
<bean id="messageListener" class="com.SomeListener" />

<!-- and this is the message listener container -->
<bean id="jmsContainer"
    class="org.springframework.jms.listener.DefaultMessageListenerContainer">
    <property name="connectionFactory" ref="xxxCF" />
    <property name="destination" ref="someQueue" />
    <property name="messageListener" ref="messageListener" />
</bean>

当我启动服务器时,侦听器似乎正确启动,因为它接收到我放入队列中的消息。

但是,一旦我运行任何与 JMS 无关的简单控制器/动作,它就会一遍又一遍地给我下面的消息......

DefaultMessag W org.springframework.jms.listener.DefaultMessageListenerContainer handleListenerSetupFailure Setup of JMS message listener invoker failed for destination 'queue:///ABCDEF.EFF.OUT?persistence=-1' - trying to recover. Cause: MQJMS2008: failed to open MQ queue ''.; nested exception is com.ibm.mq.MQException: MQJE001: Completion Code '2', Reason '2042'.
DefaultMessag I org.springframework.jms.listener.DefaultMessageListenerContainer refreshConnectionUntilSuccessful Successfully refreshed JMS Connection

ConnectionEve W   J2CA0206W: A connection error occurred.  To help determine the problem, enable the Diagnose Connection Usage option on the Connection Factory or Data Source.

ConnectionEve A   J2CA0056I: The Connection Manager received a fatal connection error from the Resource Adapter for resource JMS$XXXQCF$JMSManagedConnection@2. The exception is: javax.jms.JMSException: MQJMS2008: failed to open MQ queue ''.

ConnectionEve W   J2CA0206W: A connection error occurred.  To help determine the problem, enable the Diagnose Connection Usage option on the Connection Factory or Data Source.

ConnectionEve A   J2CA0056I: The Connection Manager received a fatal connection error from the Resource Adapter for resource jms/XXXQCF. The exception is: javax.jms.JMSException: MQJMS2008: failed to open MQ queue ''.

原来的监听器似乎仍在正常运行……但我认为控制器以某种方式触发了另一个连接?有谁知道我应该检查什么或可能导致此问题的原因?

谢谢

4

1 回答 1

3

2042 表示“正在使用的对象”。由于没有消息生产者独占使用队列的概念,因此您的一个消费者正在锁定队列。

此行为由队列定义的 DEFSOPT 属性控制。这是在队列管理器本身,而不是在托管对象定义或您的工厂选项中。从命令行以 mqm(或者如果 QMgr 在 Windows、iSeries、z/OS 等上,则为等效平台)登录时,您需要启动 runmqsc 并发出以下命令来验证并修复问题。在我的示例中,QMgr 是 PLUTO,示例队列是 SYSTEM.DEFAULT.LOCAL.QUEUE。

/home/mqm: runmqsc PLUTO
5724-H72 (C) Copyright IBM Corp. 1994, 2009.  ALL RIGHTS RESERVED.
Starting MQSC for queue manager PLUTO.

dis q(system.default.local.queue) defsopt
     1 : dis q(system.default.local.queue) defsopt
AMQ8409: Display Queue details.
   QUEUE(SYSTEM.DEFAULT.LOCAL.QUEUE)       TYPE(QLOCAL)
   DEFSOPT(EXCL)
alter ql(system.default.local.queue) defsopt(shared)
     2 : alter ql(system.default.local.queue) defsopt(shared)
AMQ8008: WebSphere MQ queue changed.
dis q(system.default.local.queue) defsopt
     3 : dis q(system.default.local.queue) defsopt
AMQ8409: Display Queue details.
   QUEUE(SYSTEM.DEFAULT.LOCAL.QUEUE)       TYPE(QLOCAL)
   DEFSOPT(SHARED)

If you display the queue and find that it is already set for DEFSOPT(SHARED) then something must be specifying exclusive use of the queue through the API. That typically means a C or base Java program since these non-JMS APIs have access to low-level WMQ functionality. Those can be a little trickier to diagnose and I usually use a trace or the SupportPac MA0W exit to display the API calls and options used. If this is the case, I'd want to know more about what is meant by "simple controller/action" as noted in the original post.

Finally, if the queue that you are accessing is a remote queue then it will resolve to a transmit queue. The channel will always set a transmit queue to GET(INHIBITED) and acquire an exclusive lock on it. This is consistent with WMQ functionality in that an application can only GET messages from a local queue.

于 2011-02-14T23:20:13.073 回答