在Websphere Application Server上将Spring CachingConnectionFactory与Websphere MQ一起使用时出错

时间:2016-02-26 06:14:25

标签: spring jms ibm-mq

使用spring CachingConnectionFactory连接到WAS上的Websphere MQ时,我收到以下错误

org.springframework.jms.IllegalStateException: **Method setExceptionListener not permitted;** nested exception is javax.jms.IllegalStateException: Method setExceptionListener not permitted
        at org.springframework.jms.support.JmsUtils.convertJmsAccessException(JmsUtils.java:279) ~[spring-jms-4.1.5.RELEASE.jar:4.1.5.RELEASE]
        at org.springframework.jms.support.JmsAccessor.convertJmsAccessException(JmsAccessor.java:169) ~[spring-jms-4.1.5.RELEASE.jar:4.1.5.RELEASE]
        at org.springframework.jms.core.JmsTemplate.execute(JmsTemplate.java:496) ~[spring-jms-4.1.5.RELEASE.jar:4.1.5.RELEASE]
        at org.springframework.jms.core.JmsTemplate.send(JmsTemplate.java:568) ~[spring-jms-4.1.5.RELEASE.jar:4.1.5.RELEASE]
        at org.springframework.jms.core.JmsTemplate.send(JmsTemplate.java:559) ~[spring-jms-4.1.5.RELEASE.jar:4.1.5.RELEASE]

我的配置如下 -

<jee:jndi-lookup id="jmsConnectionFactory"
            jndi-name="jms/XXXCF" />

<bean id="cachedConnectionFactory"
            class="org.springframework.jms.connection.CachingConnectionFactory">
            <property name="targetConnectionFactory" ref="jmsConnectionFactory"/>
            <property name="sessionCacheSize" value="50" />
        </bean>

<bean id="jmsResponseTemplate" class="org.springframework.jms.core.JmsTemplate">
            <property name="connectionFactory" ref="cachedConnectionFactory" />
            <property name="defaultDestination" ref="XXXQueue" />
        </bean>

有人知道我是否缺少弹簧或WAS方面的任何配置?提前谢谢。

1 个答案:

答案 0 :(得分:0)

我面临着同样的问题。在调试弹簧代码之后,我发现ibm因为设置错误而导致其出现问题&#34; reconnectOnException&#34;

添加

  

&LT; property name =&#34; reconnectOnException&#34;值=&#34;假&#34; /&GT;

到你的cachedConnectionFactory。你绕过了这个问题。

但是现在当然,在抛出异常之后,我会得到像这样的例外

  • 制作人已关闭
  • org.springframework.jms.IllegalStateException:会话已关闭;
  • javax.jms.IllegalStateException:连接已关闭

有没有人知道如何让IBM在reconnectOnException =&#34; true&#34; ?