码迷,mamicode.com
首页 > 编程语言 > 详细

Spring ActiveMQ Caused By: javax.jms.IllegalStateException: Connection closed

时间:2017-09-11 19:47:15      阅读:268      评论:0      收藏:0      [点我收藏+]

标签:let   activemq   配置   根据   项目   修改   ati   unknown   html   

根据 http://www.cnblogs.com/yshyee/p/7448808.html 进行JMS操作时,发送跟监听放到不同的项目中进行时,出现以下异常信息:

org.springframework.jms.IllegalStateException: Connection closed; nested exception is javax.jms.IllegalStateException: Connection closed
        at org.springframework.jms.support.JmsUtils.convertJmsAccessException(JmsUtils.java:279)
        at org.springframework.jms.support.JmsAccessor.convertJmsAccessException(JmsAccessor.java:169)
        at org.springframework.jms.core.JmsTemplate.executeLocal(JmsTemplate.java:987)
        at org.springframework.jms.core.JmsTemplate.sendAndReceive(JmsTemplate.java:913)
        at org.springframework.jms.core.JmsTemplate.sendAndReceive(JmsTemplate.java:904)
        Truncated. see log file for complete stacktrace
Caused By: javax.jms.IllegalStateException: Connection closed
        at org.apache.activemq.jms.pool.PooledConnection.assertNotClosed(PooledConnection.java:206)
        at org.apache.activemq.jms.pool.PooledConnection.start(PooledConnection.java:94)
        at org.springframework.jms.connection.SingleConnectionFactory$SharedConnectionInvocationHandler.localStart(SingleConnectionFactory.java:632)
        at org.springframework.jms.connection.SingleConnectionFactory$SharedConnectionInvocationHandler.invoke(SingleConnectionFactory.java:569)
        at com.sun.proxy.$Proxy189.start(Unknown Source)
        Truncated. see log file for complete stacktrace

解决方法:

修改 amqConnectionFactory配置如下:

    <!-- ActiveMQ 连接工厂 -->
    <bean id="amqConnectionFactory" class="org.apache.activemq.ActiveMQConnectionFactory">
        <property name="brokerURL">
            <value>${amq.broker.url}</value>
        </property>
        <property name="userName">
            <value>${amq.username}</value>
        </property>
        <property name="password">
            <value>${amq.password}</value>
        </property>
    </bean>

 

Spring ActiveMQ Caused By: javax.jms.IllegalStateException: Connection closed

标签:let   activemq   配置   根据   项目   修改   ati   unknown   html   

原文地址:http://www.cnblogs.com/yshyee/p/7506235.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!