JMS消息侦听器调用程序的设置因目标失败 - 会话已关闭

时间:2015-04-20 04:58:09

标签: java jms jndi ibm-mq spring-jms

  <?xml version="1.0" encoding="UTF-8"?>
<beans:beans xmlns="http://www.springframework.org/schema/mvc"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:beans="http://www.springframework.org/schema/beans"
    xmlns:context="http://www.springframework.org/schema/context"
    xmlns:jms="http://www.springframework.org/schema/jms" xmlns:tx="http://www.springframework.org/schema/tx"
    xmlns:oxm="http://www.springframework.org/schema/oxm" xmlns:util="http://www.springframework.org/schema/util"
    xmlns:p="http://www.springframework.org/schema/p"
    xsi:schemaLocation="http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc.xsd
        http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
        http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd
        http://www.springframework.org/schema/jms http://www.springframework.org/schema/jms/spring-jms-3.0.xsd
        http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.0.xsd
        http://www.springframework.org/schema/oxm  http://www.springframework.org/schema/oxm/spring-oxm-3.0.xsd
        http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-3.0.xsd">

    <beans:bean id="propertyConfigurer"
        class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
        <beans:property name="locations">
            <beans:list>
                <beans:value>classpath:/Transformer.properties</beans:value>
            </beans:list>
        </beans:property>
    </beans:bean>

    <!-- SCA Conncetion Factory -->

    <beans:bean id="jmsFactory"
        class="org.springframework.jndi.JndiObjectFactoryBean">
        <beans:property name="jndiName" value="${sca.mq.conn.jndi}" />
        <beans:property name="resourceRef" value="false" />
        <beans:property name="lookupOnStartup" value="false" />
        <beans:property name="cache" value="true" />
        <beans:property name="proxyInterface" value="javax.jms.ConnectionFactory" />
    </beans:bean>


    <beans:bean id="transactionManager" class="org.springframework.jms.connection.JmsTransactionManager">
        <beans:property name="connectionFactory" ref="jmsFactory" />
    </beans:bean>

    <beans:bean id="jmsSecurityFactory"
        class="org.springframework.jms.connection.UserCredentialsConnectionFactoryAdapter">

        <beans:property name="targetConnectionFactory" ref="jmsFactory" />
        <beans:property name="username" value="mqm" />
        <beans:property name="password" value=" " />
    </beans:bean>

    <jms:listener-container acknowledge="transacted"
        cache="session" connection-factory="jmsSecurityFactory"
        concurrency="1" container-type="default" 
        container-class="org.com.vt.jms.container.sampleMessageListenerContainer">
        <jms:listener id="QL.TEST.00.IRQ"  destination="QL.TEST.00.IRQ"  ref="testMessageListener" method="onMessage" />
        <jms:listener id="QL.TEST.01.IRQ"  destination="QL.TEST.01.IRQ"  ref="testMessageListener" method="onMessage" />
        <jms:listener id="QL.TEST.02.IRQ"  destination="QL.TEST.02.IRQ"  ref="testMessageListener" method="onMessage" />
        <jms:listener id="QL.TEST.03.IRQ"  destination="QL.TEST.03.IRQ"  ref="testMessageListener" method="onMessage" />
        <jms:listener id="QL.TEST.04.IRQ"  destination="QL.TEST.04.IRQ"  ref="testMessageListener" method="onMessage" />
        <jms:listener id="QL.TEST.05.IRQ"  destination="QL.TEST.05.IRQ"  ref="testMessageListener" method="onMessage" />
        <jms:listener id="QL.TEST.06.IRQ"  destination="QL.TEST.06.IRQ"  ref="testMessageListener" method="onMessage" />
        <jms:listener id="QL.TEST.07.IRQ"  destination="QL.TEST.07.IRQ"  ref="testMessageListener" method="onMessage" />
        <jms:listener id="QL.TEST.08.IRQ"  destination="QL.TEST.08.IRQ"  ref="testMessageListener" method="onMessage" />
        <jms:listener id="QL.TEST.09.IRQ"  destination="QL.TEST.09.IRQ"  ref="testMessageListener" method="onMessage" />
    </jms:listener-container>

    <beans:bean id="jmsTemplate" class="org.springframework.jms.core.JmsTemplate">
        <beans:property name="sessionTransacted" value="true" />
        <beans:property name="connectionFactory" ref="jmsFactory"></beans:property>
    </beans:bean>

    <!-- JMS Beans -->
    <beans:bean id="jmsMessageProducer" class="org.com.helpers.JmsMessageProducer">

    </beans:bean>

    <beans:bean id="testMessageListener"
        class="org.com.jms.listener.TestMessageListener" scope="prototype">

    </beans:bean>

    </beans:beans>

简单的JMS配置,使用JNDI调用来建立连接工厂。

但是,当我尝试启动其中一个侦听器时,我收到以下错误消息:

[4/19/15 2:23:16:560 PDT] 00000376 sampleMessageLi W org.springframework.jms.listener.DefaultMessageListenerContainer handleListenerSetupFailure Setup of JMS message listener invoker failed for destination 'QL.TEST.00.IRQ' - trying to recover. Cause: Session closed
[4/19/15 2:23:16:561 PDT] 00000376 sampleMessageLi I org.springframework.jms.listener.DefaultMessageListenerContainer refreshConnectionUntilSuccessful Successfully refreshed JMS Connection

任何人遇到类似问题或对此错误消息有所了解?

0 个答案:

没有答案