spring+activeMQ关闭tomcat服务器报错 -问答-阿里云开发者社区-阿里云

开发者社区> 问答> 正文
阿里云
为了无法计算的价值
打开APP
阿里云APP内打开

spring+activeMQ关闭tomcat服务器报错

    <property name="brokerURL" value="${activeMQ.connection.brokerURL}" />
    <property name="userName" value="${activeMQ.connection.userName}"></property>
    <property name="password" value="${activeMQ.connection.password}"></property>
</bean>

<bean id="jmsFactory"
    class="org.springframework.jms.connection.CachingConnectionFactory">    
    <property name="targetConnectionFactory" ref="amqConnectionFactory"></property>
    <property name="sessionCacheSize" value="${activeMQ.connection.sessionCacheSize}" />
</bean>

<!-- Spring JMS Template -->
<bean id="myJmsTemplate" class="org.springframework.jms.core.JmsTemplate">
    <property name="connectionFactory" ref="jmsFactory" />
</bean>
<!-- Spring JMS Template -->
<bean id="myJmsTemplate" class="org.springframework.jms.core.JmsTemplate">
    <property name="connectionFactory" ref="jmsFactory" />
</bean>

<!-- 定义消息队列 -->
<bean id="sendMessageQueue" class="org.apache.activemq.command.ActiveMQQueue">
    <constructor-arg value="com.xxx.push.queue" />
</bean>

<!-- Message Sender Definition -->
<bean id="jpushSender" class="com.xxx.activemqSpring.JPushSender">
    <property name="jmsTemplate" ref="myJmsTemplate"></property>
    <property name="queue" ref="sendMessageQueue"></property>
</bean>

<!-- Message Receiver Definition -->

<bean id="jpushListener" class="com.xxx.activemqSpring.JPushListener"></bean>
<bean id="jmsContainer"
    class="org.springframework.jms.listener.DefaultMessageListenerContainer">
    <property name="connectionFactory" ref="jmsFactory" />
    <property name="destination" ref="sendMessageQueue" />
    <property name="messageListener" ref="jpushListener" />
    <!-- <property name="concurrentConsumers" value="3" /> -->
</bean>

以上为我的activemq+spring配置文件。启动过程及使用不会报错,但是在关闭tomcat服务器时会抛出未终止线程的错误,错误代码如下:
警告: The web application [xxx] appears to have started a thread named [ActiveMQ Task-1] but has failed to stop it. This is very likely to create a memory leak. Stack trace of thread:
sun.misc.Unsafe.park(Native Method)
java.util.concurrent.locks.LockSupport.parkNanos(Unknown Source)
java.util.concurrent.SynchronousQueue$TransferStack.awaitFulfill(Unknown Source)
java.util.concurrent.SynchronousQueue$TransferStack.transfer(Unknown Source)
java.util.concurrent.SynchronousQueue.poll(Unknown Source)
java.util.concurrent.ThreadPoolExecutor.getTask(Unknown Source)
java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
java.lang.Thread.run(Unknown Source)
请教各位大神,什么原因?添加destroy-method吗?

展开
收起
你啊你abc 2017-03-11 21:35:37 3581 0
1 条回答
写回答
取消 提交回答
  • jingtian.zjt

    需要主动实现destrory-method结束ActiveMQ Task-1~希望能帮到你

    2019-07-17 20:54:22
    赞同 展开评论 打赏
问答排行榜
最热
最新
相关电子书
更多
网站/服务器取证 实践与挑战
立即下载
固守服务器的第一道防线——美联集团堡垒机的前世今生
立即下载
机器学习在大规模服务器治理复杂场景的实践
立即下载