Spring amqp 重新启动RabbitMQ服务器后,Spring AMQP无法连接回RabbitMQ服务器

Spring amqp 重新启动RabbitMQ服务器后,Spring AMQP无法连接回RabbitMQ服务器,spring-amqp,Spring Amqp,我们的应用程序能够连接到RabbitMQ服务器,在消息侦听器中接收消息,一切正常。但当RabbitMQ重新启动时,我们会在日志中看到下面的异常,并且侦听器中不会收到消息。一旦我们重新启动了应用程序容器,那么一切都开始工作了。我们无法在Prodcution环境中重新启动应用程序,我们希望应用程序能够在RabbitMQ服务器启动后恢复到RabbitMQ的连接。有人能帮忙吗 2018-05-10 09:10:01,561[SimpleAsyncTaskExecutor-34]|DEBUG|org.sp

我们的应用程序能够连接到RabbitMQ服务器,在消息侦听器中接收消息,一切正常。但当RabbitMQ重新启动时,我们会在日志中看到下面的异常,并且侦听器中不会收到消息。一旦我们重新启动了应用程序容器,那么一切都开始工作了。我们无法在Prodcution环境中重新启动应用程序,我们希望应用程序能够在RabbitMQ服务器启动后恢复到RabbitMQ的连接。有人能帮忙吗

2018-05-10 09:10:01,561[SimpleAsyncTaskExecutor-34]|DEBUG|org.springframework.beans.factory.support.DefaultListableBeanFactory|13-org.springframework.beans-3.1.4.RELEASE|Returning cached instance of singleton bean 'org.springframework.amqp.core.Queue#3'
2018-05-10 09:10:01,560[SimpleAsyncTaskExecutor-27]|DEBUG|org.springframework.amqp.rabbit.listener.BlockingQueueConsumer|435-wrap_file_._jetstream_thirdparty_spring-rabbit-1.3.6.RELEASE.jar-0.0.0|Closing Rabbit Channel: null
2018-05-10 09:10:01,563[SimpleAsyncTaskExecutor-34]|DEBUG|org.springframework.amqp.rabbit.listener.BlockingQueueConsumer|435-wrap_file_._jetstream_thirdparty_spring-rabbit-1.3.6.RELEASE.jar-0.0.0|Starting consumer Consumer: tags=[[]], channel=null, acknowledgeMode=MANUAL local queue size=0
2018-05-10 09:10:01,560[SimpleAsyncTaskExecutor-32]|DEBUG|org.springframework.beans.factory.support.DefaultListableBeanFactory|13-org.springframework.beans-3.1.4.RELEASE|Returning cached instance of singleton bean 'org.springframework.amqp.core.Queue#1'
2018-05-10 09:10:01,559[SimpleAsyncTaskExecutor-29]|WARN|org.springframework.amqp.rabbit.listener.SimpleMessageListenerContainer|435-wrap_file_._jetstream_thirdparty_spring-rabbit-1.3.6.RELEASE.jar-0.0.0|Consumer raised exception, processing can restart if the connection factory supports it
org.springframework.amqp.AmqpConnectException: java.net.ConnectException: Connection refused
    at org.springframework.amqp.rabbit.support.RabbitExceptionTranslator.convertRabbitAccessException(RabbitExceptionTranslator.java:54)[435:wrap_file_._jetstream_thirdparty_spring-rabbit-1.3.6.RELEASE.jar:0]
    at org.springframework.amqp.rabbit.connection.AbstractConnectionFactory.createBareConnection(AbstractConnectionFactory.java:195)[435:wrap_file_._jetstream_thirdparty_spring-rabbit-1.3.6.RELEASE.jar:0]
    at org.springframework.amqp.rabbit.connection.CachingConnectionFactory.createConnection(CachingConnectionFactory.java:371)[435:wrap_file_._jetstream_thirdparty_spring-rabbit-1.3.6.RELEASE.jar:0]
    at org.springframework.amqp.rabbit.connection.ConnectionFactoryUtils$1.createConnection(ConnectionFactoryUtils.java:80)[435:wrap_file_._jetstream_thirdparty_spring-rabbit-1.3.6.RELEASE.jar:0]
    at org.springframework.amqp.rabbit.connection.ConnectionFactoryUtils.doGetTransactionalResourceHolder(ConnectionFactoryUtils.java:130)[435:wrap_file_._jetstream_thirdparty_spring-rabbit-1.3.6.RELEASE.jar:0]
    at org.springframework.amqp.rabbit.connection.ConnectionFactoryUtils.getTransactionalResourceHolder(ConnectionFactoryUtils.java:67)[435:wrap_file_._jetstream_thirdparty_spring-rabbit-1.3.6.RELEASE.jar:0]
    at org.springframework.amqp.rabbit.listener.BlockingQueueConsumer.start(BlockingQueueConsumer.java:365)[435:wrap_file_._jetstream_thirdparty_spring-rabbit-1.3.6.RELEASE.jar:0]
    at org.springframework.amqp.rabbit.listener.SimpleMessageListenerContainer$AsyncMessageProcessingConsumer.run(SimpleMessageListenerContainer.java:1009)[435:wrap_file_._jetstream_thirdparty_spring-rabbit-1.3.6.RELEASE.jar:0]
    at java.lang.Thread.run(Thread.java:745)[:1.7.0_80]
Caused by: java.net.ConnectException: Connection refused
    at java.net.PlainSocketImpl.socketConnect(Native Method)[:1.7.0_80]
    at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:339)[:1.7.0_80]
    at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:200)[:1.7.0_80]
    at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:182)[:1.7.0_80]
    at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)[:1.7.0_80]
    at java.net.Socket.connect(Socket.java:579)[:1.7.0_80]
    at sun.security.ssl.SSLSocketImpl.connect(SSLSocketImpl.java:625)[:1.7.0_80]
    at com.rabbitmq.client.impl.SocketFrameHandlerFactory.create(SocketFrameHandlerFactory.java:50)[432:com.rabbitmq.client:4.3.0]
    at com.rabbitmq.client.impl.recovery.RecoveryAwareAMQConnectionFactory.newConnection(RecoveryAwareAMQConnectionFactory.java:61)[432:com.rabbitmq.client:4.3.0]
    at com.rabbitmq.client.impl.recovery.AutorecoveringConnection.init(AutorecoveringConnection.java:99)[432:com.rabbitmq.client:4.3.0]
    at com.rabbitmq.client.ConnectionFactory.newConnection(ConnectionFactory.java:925)[432:com.rabbitmq.client:4.3.0]
    at com.rabbitmq.client.ConnectionFactory.newConnection(ConnectionFactory.java:884)[432:com.rabbitmq.client:4.3.0]
    at com.rabbitmq.client.ConnectionFactory.newConnection(ConnectionFactory.java:842)[432:com.rabbitmq.client:4.3.0]
    at com.rabbitmq.client.ConnectionFactory.newConnection(ConnectionFactory.java:1026)[432:com.rabbitmq.client:4.3.0]
    at org.springframework.amqp.rabbit.connection.AbstractConnectionFactory.createBareConnection(AbstractConnectionFactory.java:191)[435:wrap_file_._jetstream_thirdparty_spring-rabbit-1.3.6.RELEASE.jar:0]
    ... 7 more
这个异常对我来说似乎很奇怪,因为如果RabbitMQ拒绝连接,那么当我们重新启动应用程序时,连接是如何建立的。
这个问题让我很为难。

1.3.6版本太旧,不受支持。如果你想升级到最新的版本,最好是:至少<代码> 1.7.7。也请阅读以下内容: