tomcat啟動報錯,找不到對應的 queue,從而引發記憶體流失

來源:互聯網
上載者:User

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服務提供服務,且某一指定隊列不存在時,項目卻無法正常啟動,

由此可見,代碼的健壯性有待改進哪。




聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.