Rabbitmq:手动创建的用户无法正常工作

时间:2015-07-28 07:28:47

标签: grails rabbitmq

我刚开始使用 Rabbitmq ,我试图将它与grails一起使用。我成功地用grails设置了rabbitmq。当我使用username =" guest"和密码="客人"它工作正常,但当我尝试使用手动创建的用户时,它会抛出一些错误,如下所示:

    Error initializing the application: null
    java.io.IOException
    at com.rabbitmq.client.impl.AMQChannel.wrap(AMQChannel.java:106)
    at com.rabbitmq.client.impl.AMQChannel.wrap(AMQChannel.java:102)
    at com.rabbitmq.client.impl.AMQChannel.exnWrappingRpc(AMQChannel.java:124)
    at com.rabbitmq.client.impl.AMQConnection.start(AMQConnection.java:376)
    at com.rabbitmq.client.impl.recovery.RecoveryAwareAMQConnectionFactory.newConnection(RecoveryAwareAMQConnectionFactory.java:36)
    at com.rabbitmq.client.impl.recovery.AutorecoveringConnection.init(AutorecoveringConnection.java:83)
    at com.rabbitmq.client.ConnectionFactory.newConnection(ConnectionFactory.java:595)
    at com.rabbitmq.client.ConnectionFactory.newConnection(ConnectionFactory.java:637)
    at com.budjb.rabbitmq.connection.ConnectionContextImpl.start(ConnectionContextImpl.groovy:101)
    at com.budjb.rabbitmq.connection.ConnectionManagerImpl.start(ConnectionManagerImpl.groovy:191)
    at com.budjb.rabbitmq.connection.ConnectionManagerImpl$_start_closure4.doCall(ConnectionManagerImpl.groovy:176)
    at com.budjb.rabbitmq.connection.ConnectionManagerImpl.start(ConnectionManagerImpl.groovy:174)
    at com.budjb.rabbitmq.RabbitContextImpl.startConnections(RabbitContextImpl.groovy:193)
    at com.budjb.rabbitmq.RabbitContextImpl.start(RabbitContextImpl.groovy:78)
    at com.budjb.rabbitmq.RabbitContextProxy.start(RabbitContextProxy.groovy:188)
    at RabbitmqNativeGrailsPlugin$_closure2.doCall(RabbitmqNativeGrailsPlugin.groovy:189)
    at java.util.concurrent.FutureTask.run(FutureTask.java:262)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
    at java.lang.Thread.run(Thread.java:744)
Caused by: com.rabbitmq.client.ShutdownSignalException: connection error
    at com.rabbitmq.utility.ValueOrException.getValue(ValueOrException.java:67)
    at com.rabbitmq.utility.BlockingValueOrException.uninterruptibleGetValue(BlockingValueOrException.java:33)
    at com.rabbitmq.client.impl.AMQChannel$BlockingRpcContinuation.getReply(AMQChannel.java:348)
    at com.rabbitmq.client.impl.AMQChannel.privateRpc(AMQChannel.java:221)
    at com.rabbitmq.client.impl.AMQChannel.exnWrappingRpc(AMQChannel.java:118)
    ... 17 more
Caused by: java.io.EOFException
    at java.io.DataInputStream.readUnsignedByte(DataInputStream.java:290)
    at com.rabbitmq.client.impl.Frame.readFrom(Frame.java:95)
    at com.rabbitmq.client.impl.SocketFrameHandler.readFrame(SocketFrameHandler.java:139)
    at com.rabbitmq.client.impl.AMQConnection$MainLoop.run(AMQConnection.java:534)
    ... 1 more

我向该用户提供了所有权限,并将管理员添加为标记。请帮帮我。

2 个答案:

答案 0 :(得分:1)

我认为您需要先手动创建虚拟主机,然后尝试添加创建的用户。

干杯。

答案 1 :(得分:1)

实际上我遇到了同样的问题,你只是检查或首先按照步骤: -

1)使用命令创建用户 sudo rabbitmqctl add_user username password

2)现在为您的用户名设置标签为admin sudo rabbitmqctl set_user_tags username administrator

3)现在创建一个新的virtualHost by sudo rabbitmqctl add_vhost test

4)之后给予完全许可 sudo rabbitmqctl set_permissions -p test username ".*" ".*" ".*"

5)现在最后在你的配置文件中定义

  

连接主机:" Ip用于您的服务器",用户名:" admin",密码:"密码" ,virtualHost:" test"

现在再次运行你的代码它将成功运行。

享受!!