本文主要是介绍reply-code=530, reply-text=NOT_ALLOWED - access to vhost '/' refused for user user_admin,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
Java使用amqp-client连接rabbitmq服务端,报出如下异常
Exception in thread "main" java.io.IOExceptionat com.rabbitmq.client.impl.AMQChannel.wrap(AMQChannel.java:105)at com.rabbitmq.client.impl.AMQChannel.wrap(AMQChannel.java:101)at com.rabbitmq.client.impl.AMQChannel.exnWrappingRpc(AMQChannel.java:123)at com.rabbitmq.client.impl.AMQConnection.start(AMQConnection.java:377)at com.rabbitmq.client.ConnectionFactory.newConnection(ConnectionFactory.java:824)at com.rabbitmq.client.ConnectionFactory.newConnection(ConnectionFactory.java:778)at com.rabbitmq.client.ConnectionFactory.newConnection(ConnectionFactory.java:868)at rq.Producer.main(Producer.java:30)at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)at java.lang.reflect.Method.invoke(Method.java:498)at com.intellij.rt.execution.application.AppMain.main(AppMain.java:147)
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 '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:32)at com.rabbitmq.client.impl.AMQChannel$BlockingRpcContinuation.getReply(AMQChannel.java:360)at com.rabbitmq.client.impl.AMQChannel.privateRpc(AMQChannel.java:225)at com.rabbitmq.client.impl.AMQChannel.exnWrappingRpc(AMQChannel.java:117)... 10 more
定位发现是连接rabbitmq使用的用户没有赋予访问权限,我创建的是admin用户,给admin用户赋予‘/’目录的访问权限就可以,执行如下命令:
sudo rabbitmqctl set_permissions -p / admin '.*' '.*' '.*'
这篇关于reply-code=530, reply-text=NOT_ALLOWED - access to vhost '/' refused for user user_admin的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!