rabbitmq 连接报错 An unexpected connection driver error occured(亲测)
在服務器上安裝了一個RabbitMq,并新創建了一個用戶授予了管理員角色,登錄控制臺查看一切正常,興高采烈啟動項目進行連接,結果一盆冷水下來,報如下錯誤:
o.s.a.r.l.SimpleMessageListenerContainer : Failed to check/redeclare auto-delete queue(s).
org.springframework.amqp.AmqpConnectException: java.net.ConnectException: Connection refused: connect
? ? at org.springframework.amqp.rabbit.support.RabbitExceptionTranslator.convertRabbitAccessException(RabbitExceptionTranslator.java:62) ~[spring-rabbit-1.7.4.RELEASE.jar:na]
? ? at org.springframework.amqp.rabbit.connection.AbstractConnectionFactory.createBareConnection(AbstractConnectionFactory.java:368) ~[spring-rabbit-1.7.4.RELEASE.jar:na]
? ? at org.springframework.amqp.rabbit.connection.CachingConnectionFactory.createConnection(CachingConnectionFactory.java:573) ~[spring-rabbit-1.7.4.RELEASE.jar:na]
? ? at org.springframework.amqp.rabbit.core.RabbitTemplate.doExecute(RabbitTemplate.java:1430) ~[spring-rabbit-1.7.4.RELEASE.jar:na]
? ? at org.springframework.amqp.rabbit.core.RabbitTemplate.execute(RabbitTemplate.java:1411) ~[spring-rabbit-1.7.4.RELEASE.jar:na]
? ? at org.springframework.amqp.rabbit.core.RabbitTemplate.execute(RabbitTemplate.java:1387) ~[spring-rabbit-1.7.4.RELEASE.jar:na]
? ? at org.springframework.amqp.rabbit.core.RabbitAdmin.getQueueProperties(RabbitAdmin.java:336) ~[spring-rabbit-1.7.4.RELEASE.jar:na]
? ? at org.springframework.amqp.rabbit.listener.SimpleMessageListenerContainer.redeclareElementsIfNecessary(SimpleMessageListenerContainer.java:1171) ~[spring-rabbit-1.7.4.RELEASE.jar:na]
? ? at org.springframework.amqp.rabbit.listener.SimpleMessageListenerContainer$AsyncMessageProcessingConsumer.run(SimpleMessageListenerContainer.java:1422) [spring-rabbit-1.7.4.RELEASE.jar:na]
? ? at java.lang.Thread.run(Thread.java:748) [na:1.8.0_131]
2018-09-21 14:44:55.695 ERROR [bootstrap,,,] 9248 --- [.168.4.201:5672] c.r.c.impl.ForgivingExceptionHandler ? ? : An unexpected connection driver error occured
java.net.SocketException: socket closed
? ? at java.net.SocketInputStream.socketRead0(Native Method)
? ? at java.net.SocketInputStream.socketRead(SocketInputStream.java:116)
? ? at java.net.SocketInputStream.read(SocketInputStream.java:170)
? ? at java.net.SocketInputStream.read(SocketInputStream.java:141)
? ? at java.io.BufferedInputStream.fill(BufferedInputStream.java:246)
? ? at java.io.BufferedInputStream.read(BufferedInputStream.java:265)
? ? at java.io.DataInputStream.readUnsignedByte(DataInputStream.java:288)
? ? at com.rabbitmq.client.impl.Frame.readFrom(Frame.java:91)
? ? at com.rabbitmq.client.impl.SocketFrameHandler.readFrame(SocketFrameHandler.java:164)
? ? at com.rabbitmq.client.impl.AMQConnection$MainLoop.run(AMQConnection.java:571)
? ? at java.lang.Thread.run(Thread.java:745)
起先以為是配置錯誤,確認配置沒問題后,百度一下,發現是給用戶授予了角色,只能登錄控制臺,但是沒有給讀寫以及管理隊列的權限,通過控制臺admin按鈕查看
通過命令授權
語法: set_permissions [-p <vhostpath>] <user> <conf> <write> <read>
執行: rabbitmqctl set_permissions -p / admin .* .* .* 完成對admin的授權,然后啟動項目就正常了
————————————————
版權聲明:本文為CSDN博主「Yeah-小海」的原創文章,遵循CC 4.0 BY-SA版權協議,轉載請附上原文出處鏈接及本聲明。
原文鏈接:https://blog.csdn.net/zht741322694/article/details/82801873
總結
以上是生活随笔為你收集整理的rabbitmq 连接报错 An unexpected connection driver error occured(亲测)的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 亲兄妹恋知乎(亲兄妹恋小说)
- 下一篇: 职业能力(说一说职业能力的简介)