Error: Reply-code=403, reply-text=ACCESS_REFUSED

875 views
Skip to first unread message

Roxane

unread,
May 23, 2018, 5:19:48 AM5/23/18
to rabbitmq-users
Hello,
I am trying to set up rabbitmq and test it locally using the Java API. I had this working previously, however after I upgraded on macos using homebrew I am experiencing issues with declaring a queue.

So once I start rabbitmq I have two users (guest and test) with all possible permissions and a vhost dev:
$ rabbitmqctl list_users
Listing users ...
guest [administrator]
test  [administrator]
 
$ rabbitmqctl list_permissions -p dev
Listing permissions for vhost "dev" ...
guest “.*”  “.*”  “.*”
test  “.*”  “.*”  “.*”

My publisher code just contains the example from the Java tutorial more or less. 

 
    ConnectionFactory factory = new ConnectionFactory();
    factory.setHost("localhost");
    factory.setVirtualHost("dev");
    factory.setUsername("test");
    factory.setPassword("test");
    Connection connection = factory.newConnection();
      
      Channel channel = connection.createChannel();
      channel.queueDeclare("hello", true, false, false, null);
      System.out.println(" [*] Waiting for messages. To exit press CTRL+C");

But as soon as I get to declaring the queue I get the error : channel error; protocol method: #method<channel.close>(reply-code=403, reply-text=ACCESS_REFUSED - access to queue 'hello' in vhost 'dev' refused for user 'test', class-id=50, method-id=10)

The stack trace I get :

Exception in thread "main" java.io.IOException

at 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.ChannelN.queueDeclare(ChannelN.java:948)

at com.rabbitmq.client.impl.recovery.AutorecoveringChannel.queueDeclare(AutorecoveringChannel.java:333)

at project.myproject.main(TestServer.java:60)

Caused by: com.rabbitmq.client.ShutdownSignalException: channel error; protocol method: #method<channel.close>(reply-code=403, reply-text=ACCESS_REFUSED - access to queue 'hello' in vhost 'dev' refused for user 'test', class-id=50, method-id=10)

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:366)

at com.rabbitmq.client.impl.AMQChannel.privateRpc(AMQChannel.java:229)

at com.rabbitmq.client.impl.AMQChannel.exnWrappingRpc(AMQChannel.java:117)

... 3 more



Apparently my user test does not have access. But how can I give him the correct permissions? 

Thank  you and best regards 

Stuart Johnston

unread,
May 23, 2018, 5:43:39 AM5/23/18
to rabbitmq-users
rabbitmqctl set_permissions -p / test".*" ".*" ".*"

Roxane

unread,
May 23, 2018, 5:48:21 AM5/23/18
to rabbitmq-users
On Wednesday, 23 May 2018 11:43:39 UTC+2, Stuart Johnston wrote:
rabbitmqctl set_permissions -p / test".*" ".*" ".*"

This permission is also set. But that should be irrelevant right, since I use "dev" instead of the default?
BR 

Michael Klishin

unread,
May 23, 2018, 6:38:17 AM5/23/18
to rabbitm...@googlegroups.com
The permissions recommended by Stuart are very broad but it's a reasonable start.
They are for the / virtual host. You use a different vhost, so the -p argument must be given a different value.

See [1] for the docs.


--
You received this message because you are subscribed to the Google Groups "rabbitmq-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rabbitmq-users+unsubscribe@googlegroups.com.
To post to this group, send email to rabbitmq-users@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
MK

Staff Software Engineer, Pivotal/RabbitMQ
Reply all
Reply to author
Forward
0 new messages