tomcat启动报错,找不到对应的 queue,从而引发内存泄漏

来源:互联网 发布:编程员工资 编辑:程序博客网 时间:2024/04/28 11:13

tomcat启动报错,无法创建 bean listenerStatusChangeDealHandler, no queue 'STOCK.NOTIFY_CHANGE.INTER.CACHE.QUEUE' in vhost

从启动日志来看,有时候仅会看到内存泄漏,而没有与queue相关的日志,很容易走错方向。

按照 http://blog.csdn.net/wangjunjun2008/article/details/23375501 的方法可以看到详细日志,从而确定报错原因

tomcat启动报错,无法创建 bean listenerStatusChangeDealHandler, no queue 'STOCK.NOTIFY_CHANGE.INTER.CACHE.QUEUE' in vhostJun 5, 2014 1:39:42 PM org.apache.catalina.core.StandardContext listenerStartSEVERE: Exception sending context initialized event to listener instance of class org.springframework.web.context.ContextLoaderListenerorg.springframework.context.ApplicationContextException: Failed to start bean 'listenerStatusChangeDealHandler'; nested exception is org.springframework.amqp.AmqpIllegalStateException: Fatal exception on listener startupat org.springframework.context.support.DefaultLifecycleProcessor.doStart(DefaultLifecycleProcessor.java:169)...Caused by: org.springframework.amqp.AmqpIllegalStateException: Fatal exception on listener startupat org.springframework.amqp.rabbit.listener.SimpleMessageListenerContainer.doStart(SimpleMessageListenerContainer.java:339)at org.springframework.amqp.rabbit.listener.AbstractMessageListenerContainer.start(AbstractMessageListenerContainer.java:363)at org.springframework.context.support.DefaultLifecycleProcessor.doStart(DefaultLifecycleProcessor.java:166)... 33 moreCaused by: org.springframework.amqp.rabbit.listener.FatalListenerStartupException: Cannot prepare queue for listener. Either the queue doesn't exist or the broker will not allow us to use it.at org.springframework.amqp.rabbit.listener.BlockingQueueConsumer.start(BlockingQueueConsumer.java:228)at org.springframework.amqp.rabbit.listener.SimpleMessageListenerContainer$AsyncMessageProcessingConsumer.run(SimpleMessageListenerContainer.java:524)at java.lang.Thread.run(Thread.java:662)Caused by: com.rabbitmq.client.ShutdownSignalException: channel error; reason: {#method<channel.close>(reply-code=404, reply-text=NOT_FOUND - no queue 'STOCK.NOTIFY_CHANGE.INTER.CACHE.QUEUE' in vhost '/', class-id=50, method-id=10), null, ""}at com.rabbitmq.utility.ValueOrException.getValue(ValueOrException.java:67)at com.rabbitmq.utility.BlockingValueOrException.uninterruptibleGetValue(BlockingValueOrException.java:33)at com.rabbitmq.client.impl.AMQChannel$BlockingRpcContinuation.getReply(AMQChannel.java:343)at com.rabbitmq.client.impl.AMQChannel.privateRpc(AMQChannel.java:216)at com.rabbitmq.client.impl.AMQChannel.exnWrappingRpc(AMQChannel.java:118)... 11 moreCaused by: com.rabbitmq.client.ShutdownSignalException: channel error; reason: {#method<channel.close>(reply-code=404, reply-text=NOT_FOUND - no queue 'STOCK.NOTIFY_CHANGE.INTER.CACHE.QUEUE' in vhost '/', class-id=50, method-id=10), null, ""}at com.rabbitmq.client.impl.ChannelN.asyncShutdown(ChannelN.java:454)at com.rabbitmq.client.impl.ChannelN.processAsync(ChannelN.java:294)at com.rabbitmq.client.impl.AMQChannel.handleCompleteInboundCommand(AMQChannel.java:144)at com.rabbitmq.client.impl.AMQChannel.handleFrame(AMQChannel.java:91)at com.rabbitmq.client.impl.AMQConnection$MainLoop.run(AMQConnection.java:526)Jun 5, 2014 1:39:42 PM org.apache.catalina.core.StandardContext startSEVERE: Error listenerStartJun 5, 2014 1:39:42 PM org.apache.catalina.core.StandardContext startSEVERE: Context [/TravelHubPkgStock] startup failed due to previous errorsJun 5, 2014 1:39:42 PM org.apache.catalina.core.ApplicationContext logINFO: Closing Spring root WebApplicationContextJun 5, 2014 1:39:42 PM org.apache.catalina.loader.WebappClassLoader clearReferencesJdbcSEVERE: The web application [/TravelHubPkgStock] registered the JDBC driver [oracle.jdbc.driver.OracleDriver] but failed to unregister it when the web application was stopped. To prevent a memory leak, the JDBC Driver has been forcibly unregistered.Jun 5, 2014 1:39:42 PM org.apache.catalina.loader.WebappClassLoader clearReferencesThreadsSEVERE: The web application [/TravelHubPkgStock] appears to have started a thread named [Thread-2] but has failed to stop it. This is very likely to create a memory leak.Jun 5, 2014 1:39:42 PM org.apache.catalina.loader.WebappClassLoader clearReferencesThreadsSEVERE: The web application [/TravelHubPkgStock] appears to have started a thread named [Thread-3] but has failed to stop it. This is very likely to create a memory leak.Jun 5, 2014 1:39:47 PM org.apache.coyote.http11.Http11Protocol startINFO: Starting Coyote HTTP/1.1 on http-8080Jun 5, 2014 1:39:48 PM org.apache.jk.common.ChannelSocket initINFO: JK: ajp13 listening on /0.0.0.0:9090Jun 5, 2014 1:39:48 PM org.apache.jk.server.JkMain startINFO: Jk running ID=0 time=0/121  config=nullJun 5, 2014 1:39:48 PM org.apache.catalina.startup.Catalina startINFO: Server startup in 324602 ms

经过排查和测试,发现项目中使用rabbitmq服务,而rabbitmq于昨天被重装了,从而里面的队列全部没有了,导致项目启动时初始化bean时候报错。

有趣的是,之前rabbitmq停止服务时,该项目启动正常,而rabbitmq服务提供服务,且某一指定队列不存在时,项目却无法正常启动,

由此可见,代码的健壮性有待改进哪。




0 0
原创粉丝点击