赞
踩
spring.application.name=rabbitmq
spring.rabbitmq.host=127.0.0.1
spring.rabbitmq.port=15672
spring.rabbitmq.username=huitao
spring.rabbitmq.password=1234
这是配置文件!
2018-12-08 13:22:04.617 ERROR 5172 --- [127.0.0.1:15672] c.r.c.impl.ForgivingExceptionHandler : An unexpected connection driver error occured
java.net.SocketException: Socket Closed
at java.net.SocketInputStream.socketRead0(Native Method) ~[na:1.8.0_101]
at java.net.SocketInputStream.socketRead(SocketInputStream.java:116) ~[na:1.8.0_101]
at java.net.SocketInputStream.read(SocketInputStream.java:170) ~[na:1.8.0_101]
at java.net.SocketInputStream.read(SocketInputStream.java:141) ~[na:1.8.0_101]
at java.io.BufferedInputStream.fill(BufferedInputStream.java:246) ~[na:1.8.0_101]
at java.io.BufferedInputStream.read(BufferedInputStream.java:265) ~[na:1.8.0_101]
at java.io.DataInputStream.readUnsignedByte(DataInputStream.java:288) ~[na:1.8.0_101]
at com.rabbitmq.client.impl.Frame.readFrom(Frame.java:91) ~[amqp-client-5.4.3.jar:5.4.3]
at com.rabbitmq.client.impl.SocketFrameHandler.readFrame(SocketFrameHandler.java:164) ~[amqp-client-5.4.3.jar:5.4.3]
at com.rabbitmq.client.impl.AMQConnection$MainLoop.run(AMQConnection.java:596) ~[amqp-client-5.4.3.jar:5.4.3]
at java.lang.Thread.run(Thread.java:745) [na:1.8.0_101]
2018-12-08 13:22:04.617 ERROR 5172 --- [cTaskExecutor-1] o.s.a.r.l.SimpleMessageListenerContainer : Failed to check/redeclare auto-delete queue(s).
org.springframework.amqp.AmqpTimeoutException: java.util.concurrent.TimeoutException
at org.springframework.amqp.rabbit.support.RabbitExceptionTranslator.convertRabbitAccessException(RabbitExceptionTranslator.java:74) ~[spring-rabbit-2.1.2.RELEASE.jar:2.1.2.RELEASE]
at org.springframework.amqp.rabbit.connection.AbstractConnectionFactory.createBareConnection(AbstractConnectionFactory.java:509) ~[spring-rabbit-2.1.2.RELEASE.jar:2.1.2.RELEASE]
at org.springframework.amqp.rabbit.connection.CachingConnectionFactory.createConnection(CachingConnectionFactory.java:684) ~[spring-rabbit-2.1.2.RELEASE.jar:2.1.2.RELEASE]
at org.springframework.amqp.rabbit.connection.ConnectionFactoryUtils.createConnection(ConnectionFactoryUtils.java:214) ~[spring-rabbit-2.1.2.RELEASE.jar:2.1.2.RELEASE]
at org.springframework.amqp.rabbit.core.RabbitTemplate.doExecute(RabbitTemplate.java:1961) ~[spring-rabbit-2.1.2.RELEASE.jar:2.1.2.RELEASE]
at org.springframework.amqp.rabbit.core.RabbitTemplate.execute(RabbitTemplate.java:1935) ~[spring-rabbit-2.1.2.RELEASE.jar:2.1.2.RELEASE]
at org.springframework.amqp.rabbit.core.RabbitTemplate.execute(RabbitTemplate.java:1916) ~[spring-rabbit-2.1.2.RELEASE.jar:2.1.2.RELEASE]
at org.springframework.amqp.rabbit.core.RabbitAdmin.getQueueProperties(RabbitAdmin.java:393) ~[spring-rabbit-2.1.2.RELEASE.jar:2.1.2.RELEASE]
at org.springframework.amqp.rabbit.listener.AbstractMessageListenerContainer.redeclareElementsIfNecessary(AbstractMessageListenerContainer.java:1722) ~[spring-rabbit-2.1.2.RELEASE.jar:2.1.2.RELEASE]
at org.springframework.amqp.rabbit.listener.SimpleMessageListenerContainer$AsyncMessageProcessingConsumer.run(SimpleMessageListenerContainer.java:1026) [spring-rabbit-2.1.2.RELEASE.jar:2.1.2.RELEASE]
at java.lang.Thread.run(Thread.java:745) [na:1.8.0_101]
Caused by: java.util.concurrent.TimeoutException: null
at com.rabbitmq.utility.BlockingCell.get(BlockingCell.java:77) ~[amqp-client-5.4.3.jar:5.4.3]
at com.rabbitmq.utility.BlockingCell.uninterruptibleGet(BlockingCell.java:120) ~[amqp-client-5.4.3.jar:5.4.3]
at com.rabbitmq.utility.BlockingValueOrException.uninterruptibleGetValue(BlockingValueOrException.java:36) ~[amqp-client-5.4.3.jar:5.4.3]
at com.rabbitmq.client.impl.AMQChannel$BlockingRpcContinuation.getReply(AMQChannel.java:494) ~[amqp-client-5.4.3.jar:5.4.3]
at com.rabbitmq.client.impl.AMQConnection.start(AMQConnection.java:315) ~[amqp-client-5.4.3.jar:5.4.3]
at com.rabbitmq.client.ConnectionFactory.newConnection(ConnectionFactory.java:1104) ~[amqp-client-5.4.3.jar:5.4.3]
at com.rabbitmq.client.ConnectionFactory.newConnection(ConnectionFactory.java:1054) ~[amqp-client-5.4.3.jar:5.4.3]
at com.rabbitmq.client.ConnectionFactory.newConnection(ConnectionFactory.java:994) ~[amqp-client-5.4.3.jar:5.4.3]
at org.springframework.amqp.rabbit.connection.AbstractConnectionFactory.createBareConnection(AbstractConnectionFactory.java:462) ~[spring-rabbit-2.1.2.RELEASE.jar:2.1.2.RELEASE]
... 9 common frames omitted
2018-12-08 13:22:04.620 INFO 5172 --- [cTaskExecutor-1] o.s.a.r.c.CachingConnectionFactory : Attempting to connect to: [127.0.0.1:15672]
2018-12-08 13:22:09.620 ERROR 5172 --- [127.0.0.1:15672] c.r.c.impl.ForgivingExceptionHandler : An unexpected connection driver error occured
java.net.SocketException: Socket Closed
at java.net.SocketInputStream.socketRead0(Native Method) ~[na:1.8.0_101]
at java.net.SocketInputStream.socketRead(SocketInputStream.java:116) ~[na:1.8.0_101]
at java.net.SocketInputStream.read(SocketInputStream.java:170) ~[na:1.8.0_101]
at java.net.SocketInputStream.read(SocketInputStream.java:141) ~[na:1.8.0_101]
at java.io.BufferedInputStream.fill(BufferedInputStream.java:246) ~[na:1.8.0_101]
at java.io.BufferedInputStream.read(BufferedInputStream.java:265) ~[na:1.8.0_101]
at java.io.DataInputStream.readUnsignedByte(DataInputStream.java:288) ~[na:1.8.0_101]
at com.rabbitmq.client.impl.Frame.readFrom(Frame.java:91) ~[amqp-client-5.4.3.jar:5.4.3]
at com.rabbitmq.client.impl.SocketFrameHandler.readFrame(SocketFrameHandler.java:164) ~[amqp-client-5.4.3.jar:5.4.3]
at com.rabbitmq.client.impl.AMQConnection$MainLoop.run(AMQConnection.java:596) ~[amqp-client-5.4.3.jar:5.4.3]
at java.lang.Thread.run(Thread.java:745) [na:1.8.0_101]
2018-12-08 13:22:09.621 INFO 5172 --- [ main] o.s.a.r.c.CachingConnectionFactory : Attempting to connect to: [127.0.0.1:15672]
2018-12-08 13:22:14.623 INFO 5172 --- [ main] o.s.a.r.l.SimpleMessageListenerContainer : Broker not available; cannot force queue declarations during start
2018-12-08 13:22:14.623 ERROR 5172 --- [127.0.0.1:15672] c.r.c.impl.ForgivingExceptionHandler : An unexpected connection driver error occured
java.net.SocketException: Socket Closed
at java.net.SocketInputStream.socketRead0(Native Method) ~[na:1.8.0_101]
at java.net.SocketInputStream.socketRead(SocketInputStream.java:116) ~[na:1.8.0_101]
at java.net.SocketInputStream.read(SocketInputStream.java:170) ~[na:1.8.0_101]
at java.net.SocketInputStream.read(SocketInputStream.java:141) ~[na:1.8.0_101]
at java.io.BufferedInputStream.fill(BufferedInputStream.java:246) ~[na:1.8.0_101]
at java.io.BufferedInputStream.read(BufferedInputStream.java:265) ~[na:1.8.0_101]
at java.io.DataInputStream.readUnsignedByte(DataInputStream.java:288) ~[na:1.8.0_101]
at com.rabbitmq.client.impl.Frame.readFrom(Frame.java:91) ~[amqp-client-5.4.3.jar:5.4.3]
at com.rabbitmq.client.impl.SocketFrameHandler.readFrame(SocketFrameHandler.java:164) ~[amqp-client-5.4.3.jar:5.4.3]
at com.rabbitmq.client.impl.AMQConnection$MainLoop.run(AMQConnection.java:596) ~[amqp-client-5.4.3.jar:5.4.3]
at java.lang.Thread.run(Thread.java:745) [na:1.8.0_101]
2018-12-08 13:22:14.624 INFO 5172 --- [cTaskExecutor-1] o.s.a.r.c.CachingConnectionFactory : Attempting to connect to: [127.0.0.1:15672]
2018-12-08 13:22:14.625 INFO 5172 --- [cTaskExecutor-1] o.s.a.r.l.SimpleMessageListenerContainer : Restarting Consumer@bb095: tags=[[]], channel=null, acknowledgeMode=AUTO local queue size=0
2018-12-08 13:22:19.624 INFO 5172 --- [cTaskExecutor-2] o.s.a.r.c.CachingConnectionFactory : Attempting to connect to: [127.0.0.1:15672]
2018-12-08 13:22:19.625 ERROR 5172 --- [cTaskExecutor-1] o.s.a.r.l.SimpleMessageListenerContainer : Failed to check/redeclare auto-delete queue(s).
org.springframework.amqp.AmqpIOException: java.io.IOException
at org.springframework.amqp.rabbit.support.RabbitExceptionTranslator.convertRabbitAccessException(RabbitExceptionTranslator.java:71) ~[spring-rabbit-2.1.2.RELEASE.jar:2.1.2.RELEASE]
at org.springframework.amqp.rabbit.connection.AbstractConnectionFactory.createBareConnection(AbstractConnectionFactory.java:509) ~[spring-rabbit-2.1.2.RELEASE.jar:2.1.2.RELEASE]
at org.springframework.amqp.rabbit.connection.CachingConnectionFactory.createConnection(CachingConnectionFactory.java:684) ~[spring-rabbit-2.1.2.RELEASE.jar:2.1.2.RELEASE]
at org.springframework.amqp.rabbit.connection.ConnectionFactoryUtils.createConnection(ConnectionFactoryUtils.java:214) ~[spring-rabbit-2.1.2.RELEASE.jar:2.1.2.RELEASE]
at org.springframework.amqp.rabbit.core.RabbitTemplate.doExecute(RabbitTemplate.java:1961) ~[spring-rabbit-2.1.2.RELEASE.jar:2.1.2.RELEASE]
at org.springframework.amqp.rabbit.core.RabbitTemplate.execute(RabbitTemplate.java:1935) ~[spring-rabbit-2.1.2.RELEASE.jar:2.1.2.RELEASE]
at org.springframework.amqp.rabbit.core.RabbitTemplate.execute(RabbitTemplate.java:1916) ~[spring-rabbit-2.1.2.RELEASE.jar:2.1.2.RELEASE]
at org.springframework.amqp.rabbit.core.RabbitAdmin.getQueueProperties(RabbitAdmin.java:393) ~[spring-rabbit-2.1.2.RELEASE.jar:2.1.2.RELEASE]
at org.springframework.amqp.rabbit.listener.AbstractMessageListenerContainer.redeclareElementsIfNecessary(AbstractMessageListenerContainer.java:1722) ~[spring-rabbit-2.1.2.RELEASE.jar:2.1.2.RELEASE]
at org.springframework.amqp.rabbit.listener.SimpleMessageListenerContainer$AsyncMessageProcessingConsumer.run(SimpleMessageListenerContainer.java:1026) [spring-rabbit-2.1.2.RELEASE.jar:2.1.2.RELEASE]
at java.lang.Thread.run(Thread.java:745) [na:1.8.0_101]
Caused by: java.io.IOException: null
at com.rabbitmq.client.impl.AMQChannel.wrap(AMQChannel.java:126) ~[amqp-client-5.4.3.jar:5.4.3]
at com.rabbitmq.client.impl.AMQChannel.wrap(AMQChannel.java:122) ~[amqp-client-5.4.3.jar:5.4.3]
at com.rabbitmq.client.impl.AMQConnection.start(AMQConnection.java:373) ~[amqp-client-5.4.3.jar:5.4.3]
at com.rabbitmq.client.ConnectionFactory.newConnection(ConnectionFactory.java:1104) ~[amqp-client-5.4.3.jar:5.4.3]
at com.rabbitmq.client.ConnectionFactory.newConnection(ConnectionFactory.java:1054) ~[amqp-client-5.4.3.jar:5.4.3]
at com.rabbitmq.client.ConnectionFactory.newConnection(ConnectionFactory.java:994) ~[amqp-client-5.4.3.jar:5.4.3]
at org.springframework.amqp.rabbit.connection.AbstractConnectionFactory.createBareConnection(AbstractConnectionFactory.java:462) ~[spring-rabbit-2.1.2.RELEASE.jar:2.1.2.RELEASE]
... 9 common frames omitted
Caused by: com.rabbitmq.client.ShutdownSignalException: connection error
at com.rabbitmq.utility.ValueOrException.getValue(ValueOrException.java:66) ~[amqp-client-5.4.3.jar:5.4.3]
at com.rabbitmq.utility.BlockingValueOrException.uninterruptibleGetValue(BlockingValueOrException.java:36) ~[amqp-client-5.4.3.jar:5.4.3]
at com.rabbitmq.client.impl.AMQChannel$BlockingRpcContinuation.getReply(AMQChannel.java:494) ~[amqp-client-5.4.3.jar:5.4.3]
at com.rabbitmq.client.impl.AMQConnection.start(AMQConnection.java:315) ~[amqp-client-5.4.3.jar:5.4.3]
... 13 common frames omitted
最后在网上发现资料解说:
地址:http://www.cnblogs.com/fightfordream/p/9048905.html
这个BUG我是通过修改application.properties
中的spring.rabbitmq.port
修复好的,这里我一开始使用了http的端口15672
,发生了上述异常。后面改成了5672
可以成功连接。
映射2个端口:15672是Web管理界面的端口;5672是MQ访问的端口。
5672, 5671: used by AMQP 0-9-1 and 1.0 clients without and with TLS
15672: HTTP API clients and rabbitmqadmin (only if the management plugin is enabled)
无法自动创建队列
无法创建队列,或者找不到声明的队列。
@Bean
public Queue queue() {
return new Queue(queue_name, true);
}
这里是忘了注入队列的Bean了。
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。