Exceptions in rabbitmq with spring boot
I am getting the following exception repeatedly when I start my spring boot application with rabbitmq. The entire flow is working fine even with the below exceptions. is it to do with the auto-delete in by means ?
08 Jul 2015 16:20:17,652 [ERROR] [SimpleAsyncTaskExecutor-2] SimpleMessageListenerContainer| Failed to check/redeclare auto-delete queue(s).
java.util.concurrent.TimeoutException
at com.rabbitmq.utility.BlockingCell.get(BlockingCell.java:77)
at com.rabbitmq.utility.BlockingCell.uninterruptibleGet(BlockingCell.java:111)
at com.rabbitmq.utility.BlockingValueOrException.uninterruptibleGetValue(BlockingValueOrException.java:37)
at com.rabbitmq.client.impl.AMQChannel$BlockingRpcContinuation.getReply(AMQChannel.java:367)
at com.rabbitmq.client.impl.AMQConnection.start(AMQConnection.java:293)
at com.rabbitmq.client.ConnectionFactory.newConnection(ConnectionFactory.java:621)
at com.rabbitmq.client.ConnectionFactory.newConnection(ConnectionFactory.java:665)
at org.springframework.amqp.rabbit.connection.AbstractConnectionFactory.createBareConnection(AbstractConnectionFactory.java:208)
at org.springframework.amqp.rabbit.connection.CachingConnectionFactory.createConnection(CachingConnectionFactory.java:444)
at org.springframework.amqp.rabbit.connection.ConnectionFactoryUtils$1.createConnection(ConnectionFactoryUtils.java:80)
at org.springframework.amqp.rabbit.connection.ConnectionFactoryUtils.doGetTransactionalResourceHolder(ConnectionFactoryUtils.java:130)
at org.springframework.amqp.rabbit.connection.ConnectionFactoryUtils.getTransactionalResourceHolder(ConnectionFactoryUtils.java:67)
at org.springframework.amqp.rabbit.core.RabbitTemplate.doExecute(RabbitTemplate.java:1035)
at org.springframework.amqp.rabbit.core.RabbitTemplate.execute(RabbitTemplate.java:1028)
at org.springframework.amqp.rabbit.core.RabbitTemplate.execute(RabbitTemplate.java:1004)
at org.springframework.amqp.rabbit.core.RabbitAdmin.getQueueProperties(RabbitAdmin.java:254)
at org.springframework.amqp.rabbit.listener.SimpleMessageListenerContainer.redeclareElementsIfNecessary(SimpleMessageListenerContainer.java:963)
at org.springframework.amqp.rabbit.listener.SimpleMessageListenerContainer.access$300(SimpleMessageListenerContainer.java:83)
at org.springframework.amqp.rabbit.listener.SimpleMessageListenerContainer$AsyncMessageProcessingConsumer.run(SimpleMessageListenerContainer.java:1081)
at java.lang.Thread.run(Thread.java:745)
08 Jul 2015 16:52:47,148 [WARN ] [SimpleAsyncTaskExecutor-1] SimpleMessageListenerContainer| Consumer raised exception, processing can restart if the connection factory supports it
java.util.concurrent.TimeoutException
at com.rabbitmq.utility.BlockingCell.get(BlockingCell.java:77)
at com.rabbitmq.utility.BlockingCell.uninterruptibleGet(BlockingCell.java:111)
at com.rabbitmq.utility.BlockingValueOrException.uninterruptibleGetValue(BlockingValueOrException.java:37)
at com.rabbitmq.client.impl.AMQChannel$BlockingRpcContinuation.getReply(AMQChannel.java:367)
at com.rabbitmq.client.impl.AMQConnection.start(AMQConnection.java:293)
at com.rabbitmq.client.ConnectionFactory.newConnection(ConnectionFactory.java:621)
at com.rabbitmq.client.ConnectionFactory.newConnection(ConnectionFactory.java:665)
at org.springframework.amqp.rabbit.connection.AbstractConnectionFactory.createBareConnection(AbstractConnectionFactory.java:208)
at org.springframework.amqp.rabbit.connection.CachingConnectionFactory.createConnection(CachingConnectionFactory.java:444)
at org.springframework.amqp.rabbit.connection.ConnectionFactoryUtils$1.createConnection(ConnectionFactoryUtils.java:80)
at org.springframework.amqp.rabbit.connection.ConnectionFactoryUtils.doGetTransactionalResourceHolder(ConnectionFactoryUtils.java:130)
at org.springframework.amqp.rabbit.connection.ConnectionFactoryUtils.getTransactionalResourceHolder(ConnectionFactoryUtils.java:67)
at org.springframework.amqp.rabbit.listener.BlockingQueueConsumer.start(BlockingQueueConsumer.java:434)
at org.springframework.amqp.rabbit.listener.SimpleMessageListenerContainer$AsyncMessageProcessingConsumer.run(SimpleMessageListenerContainer.java:1083)
at java.lang.Thread.run(Thread.java:745)
the following are my beans
<rabbit:queue id="reportQueue" name="reportQueue" durable="true" auto-delete="false" exclusive="false"/>
<rabbit:direct-exchange id="reportExchange" durable="true" name="reportExchange">
<rabbit:bindings>
<rabbit:binding queue="reportQueue" key="reportBind"></rabbit:binding>
</rabbit:bindings>
</rabbit:direct-exchange>
<bean id="aListener" class="com.sample.ReportMessageListener" autowire="byName"/>
<bean id="reportMessageConverter" class="com.sample.ReportMessageConverter"/>
<rabbit:listener-container id="myListenerContainer" connection-factory="connectionFactory" acknowledge="auto" prefetch="5" concurrency="1" message-converter="reportMessageConverter" >
<rabbit:listener ref="aListener" queues="reportQueue"/>
</rabbit:listener-container>
Update:
with debug enabled the messages are
09 Jul 2015 14:46:35,284 [DEBUG] [main] SimpleMessageListenerContainer| Starting Rabbit listener container.
09 Jul 2015 14:46:38,601 [DEBUG] [elasticsearch[local_jvm_node][clusterService#updateTask][T#1]] service | [local_jvm_node] processing [routing-table-updater]: execute
09 Jul 2015 14:46:38,602 [DEBUG] [elasticsearch[local_jvm_node][clusterService#updateTask][T#1]] service | [local_jvm_node] processing [routing-table-updater]: no change in cluster_state
09 Jul 2015 14:46:40,324 [ERROR] [SimpleAsyncTaskExecutor-1] SimpleMessageListenerContainer| Failed to check/redeclare auto-delete queue(s).
java.util.concurrent.TimeoutException
at com.rabbitmq.utility.BlockingCell.get(BlockingCell.java:77)
at com.rabbitmq.utility.BlockingCell.uninterruptibleGet(BlockingCell.java:111)
at com.rabbitmq.utility.BlockingValueOrException.uninterruptibleGetValue(BlockingValueOrException.java:37)
at com.rabbitmq.client.impl.AMQChannel$BlockingRpcContinuation.getReply(AMQChannel.java:367)
at com.rabbitmq.client.impl.AMQConnection.start(AMQConnection.java:293)
at com.rabbitmq.client.ConnectionFactory.newConnection(ConnectionFactory.java:621)
at com.rabbitmq.client.ConnectionFactory.newConnection(ConnectionFactory.java:665)
at org.springframework.amqp.rabbit.connection.AbstractConnectionFactory.createBareConnection(AbstractConnectionFactory.java:208)
at org.springframework.amqp.rabbit.connection.CachingConnectionFactory.createConnection(CachingConnectionFactory.java:444)
at org.springframework.amqp.rabbit.connection.ConnectionFactoryUtils$1.createConnection(ConnectionFactoryUtils.java:80)
at org.springframework.amqp.rabbit.connection.ConnectionFactoryUtils.doGetTransactionalResourceHolder(ConnectionFactoryUtils.java:130)
at org.springframework.amqp.rabbit.connection.ConnectionFactoryUtils.getTransactionalResourceHolder(ConnectionFactoryUtils.java:67)
at org.springframework.amqp.rabbit.core.RabbitTemplate.doExecute(RabbitTemplate.java:1035)
at org.springframework.amqp.rabbit.core.RabbitTemplate.execute(RabbitTemplate.java:1028)
at org.springframework.amqp.rabbit.core.RabbitTemplate.execute(RabbitTemplate.java:1004)
at org.springframework.amqp.rabbit.core.RabbitAdmin.getQueueProperties(RabbitAdmin.java:254)
at org.springframework.amqp.rabbit.listener.SimpleMessageListenerContainer.redeclareElementsIfNecessary(SimpleMessageListenerContainer.java:963)
at org.springframework.amqp.rabbit.listener.SimpleMessageListenerContainer.access$300(SimpleMessageListenerContainer.java:83)
at org.springframework.amqp.rabbit.listener.SimpleMessageListenerContainer$AsyncMessageProcessingConsumer.run(SimpleMessageListenerContainer.java:1081)
at java.lang.Thread.run(Thread.java:745)
09 Jul 2015 14:46:40,328 [DEBUG] [SimpleAsyncTaskExecutor-1] BlockingQueueConsumer | Starting consumer Consumer: tags=[{}], channel=null, acknowledgeMode=MANUAL local queue size=0
09 Jul 2015 14:46:45,333 [DEBUG] [SimpleAsyncTaskExecutor-1] SimpleMessageListenerContainer| Recovering consumer in 5000 ms.
09 Jul 2015 14:46:50,402 [WARN ] [SimpleAsyncTaskExecutor-1] SimpleMessageListenerContainer| Consumer raised exception, processing can restart if the connection factory supports it
java.util.concurrent.TimeoutException
at com.rabbitmq.utility.BlockingCell.get(BlockingCell.java:77)
at com.rabbitmq.utility.BlockingCell.uninterruptibleGet(BlockingCell.java:111)
at com.rabbitmq.utility.BlockingValueOrException.uninterruptibleGetValue(BlockingValueOrException.java:37)
at com.rabbitmq.client.impl.AMQChannel$BlockingRpcContinuation.getReply(AMQChannel.java:367)
at com.rabbitmq.client.impl.AMQConnection.start(AMQConnection.java:293)
at com.rabbitmq.client.ConnectionFactory.newConnection(ConnectionFactory.java:621)
at com.rabbitmq.client.ConnectionFactory.newConnection(ConnectionFactory.java:665)
at org.springframework.amqp.rabbit.connection.AbstractConnectionFactory.createBareConnection(AbstractConnectionFactory.java:208)
at org.springframework.amqp.rabbit.connection.CachingConnectionFactory.createConnection(CachingConnectionFactory.java:444)
at org.springframework.amqp.rabbit.connection.ConnectionFactoryUtils$1.createConnection(ConnectionFactoryUtils.java:80)
at org.springframework.amqp.rabbit.connection.ConnectionFactoryUtils.doGetTransactionalResourceHolder(ConnectionFactoryUtils.java:130)
at org.springframework.amqp.rabbit.connection.ConnectionFactoryUtils.getTransactionalResourceHolder(ConnectionFactoryUtils.java:67)
at org.springframework.amqp.rabbit.listener.BlockingQueueConsumer.start(BlockingQueueConsumer.java:434)
at org.springframework.amqp.rabbit.listener.SimpleMessageListenerContainer$AsyncMessageProcessingConsumer.run(SimpleMessageListenerContainer.java:1083)
at java.lang.Thread.run(Thread.java:745)
09 Jul 2015 14:46:50,403 [INFO ] [SimpleAsyncTaskExecutor-1] SimpleMessageListenerContainer| Restarting Consumer: tags=[{}], channel=null, acknowledgeMode=MANUAL local queue size=0
09 Jul 2015 14:46:50,403 [DEBUG] [SimpleAsyncTaskExecutor-1] BlockingQueueConsumer | Closing Rabbit Channel: null
重新启动RabbitMQ为我解决了这个问题(Mac)。
cd /usr/local/sbin
./rabbitmqctl stop_app
./rabbitmqctl start_app
It has nothing to do with auto-delete queues (except the fact that you have some means the container is initializing the connection at this particular point in its lifecycle).
You seem to have some network issues...
java.util.concurrent.TimeoutException
....
at com.rabbitmq.client.impl.AMQConnection.start(AMQConnection.java:293)
The rabbitmq client library has a hard-coded 5 second timeout when waiting for the response for the connection start command and the server is not replying in time.
I think it is about your spring-rabbit version. I encountered the same problem as you. but I have no idea to fix it. But in my another project, it works well. Then I compared two projects. I discovered the spring-rabbit version is different from each other.
<dependency>
<groupId>org.springframework.amqp</groupId>
<artifactId>spring-rabbit</artifactId>
<version>1.6.5.RELEASE</version>
</dependency>
this new version throw TimeoutException. but
<dependency>
<groupId>org.springframework.amqp</groupId>
<artifactId>spring-rabbit</artifactId>
<version>1.4.5.RELEASE</version>
</dependency>
this version it works well. my spring-boot version is "Camden.SR2".default spring-rabbit 1.6.5.RELEASE.
Hope it helps you
链接地址: http://www.djcxy.com/p/86578.html上一篇: 如何在Google地图V3上的每个折线段上绘制箭头
下一篇: rabbitmq中的例外与春季启动