RabbitMQ报错:connection error; protocol method: #method<connection.close>(reply-code=530, reply-text=NOT_ALLOWED - access to vhost '/' refused for user 'admin', class-id=10, method-id=40)
java.io.IOException at com.rabbitmq.client.impl.AMQChannel.wrap(AMQChannel.java:129) at com.rabbitmq.client.impl.AMQChannel.wrap(AMQChannel.java:125) at com.rabbitmq.client.impl.AMQChannel.exnWrappingRpc(AMQChannel.java:147) at com.rabbitmq.client.impl.AMQConnection.start(AMQConnection.java:403) at com.rabbitmq.client.impl.recovery.RecoveryAwareAMQConnectionFactory.newConnection(RecoveryAwareAMQConnectionFactory.java:64) at com.rabbitmq.client.impl.recovery.AutorecoveringConnection.init(AutorecoveringConnection.java:156) at com.rabbitmq.client.ConnectionFactory.newConnection(ConnectionFactory.java:1106) at com.rabbitmq.client.ConnectionFactory.newConnection(ConnectionFactory.java:1063) at com.rabbitmq.client.ConnectionFactory.newConnection(ConnectionFactory.java:1198) at com.study.simple.Producer.main(Producer.java:92) Caused by: com.rabbitmq.client.ShutdownSignalException: connection error; protocol method: #method<connection.close>(reply-code=530, reply-text=NOT_ALLOWED - access to vhost '/' refused for user 'admin', class-id=10, method-id=40) at com.rabbitmq.utility.ValueOrException.getValue(ValueOrException.java:66) at com.rabbitmq.utility.BlockingValueOrException.uninterruptibleGetValue(BlockingValueOrException.java:36) at com.rabbitmq.client.impl.AMQChannel$BlockingRpcContinuation.getReply(AMQChannel.java:502) at com.rabbitmq.client.impl.AMQChannel.privateRpc(AMQChannel.java:293) at com.rabbitmq.client.impl.AMQChannel.exnWrappingRpc(AMQChannel.java:141) ... 7 more 发送消息出现异常... Disconnected from the target VM, address: '127.0.0.1:60541', transport: 'socket' Process finished with exit code 0
错误原因:admin账户没有对应的Can access virtual hosts权限
解决办法:
点击admin账户,添加对应权限即可
技术交流:添加Hilamg账号 88888 (https://hilamg.com)