学习RabbitMQ遇到的几个错误 inequivalent arg ‘durable‘ for queue ‘ack_queue‘ in vhost ‘/‘: received ‘true‘ but

  • Post author:
  • Post category:其他




1、 密码输入错误

Exception in thread "main" com.rabbitmq.client.AuthenticationFailureException: ACCESS_REFUSED - Login was refused 
using authentication mechanism PLAIN. For details see the broker logfile.


解决办法

:修改密码和服务器中账户密码一样: factory.setPassword(“1234”);



2、 启动错误

Caused by: com.rabbitmq.client.ShutdownSignalException: channel error; protocol method: #method<channel.close>(reply-code=406, reply-text=PRECONDITION_FAILED - inequivalent arg 'durable' for queue 'ack_queue' in vhost '/': received 'true' but current is 'false', class-id=50, method-id=10)
         * 	at com.rabbitmq.client.impl.ChannelN.asyncShutdown(ChannelN.java:517)
         * 	at com.rabbitmq.client.impl.ChannelN.processAsync(ChannelN.java:341)
         * 	at com.rabbitmq.client.impl.AMQChannel.handleCompleteInboundCommand(AMQChannel.java:182)
         * 	at com.rabbitmq.client.impl.AMQChannel.handleFrame(AMQChannel.java:114)
         * 	at com.rabbitmq.client.impl.AMQConnection.readFrame(AMQConnection.java:739)
         * 	at com.rabbitmq.client.impl.AMQConnection.access$300(AMQConnection.java:47)
         * 	at com.rabbitmq.client.impl.AMQConnection$MainLoop.run(AMQConnection.java:666)
         * 	at java.lang.Thread.run(Thread.java:745)
         * 	错误原因: RabbitMQ中之前队列启动过了,并且之前的是非持久化的,现在修改持久化后,RabbitMQ中的没有删除导致启动报错
         * 	解决办法: 删除RabbitMQ中的队列,再启动


错误原因

: RabbitMQ中之前队列启动过了,并且之前的是非持久化的,现在修改持久化后,RabbitMQ中的没有删除导致启动报错


解决办法

: 删除RabbitMQ中的队列,再启动



3、 生产者没有开启

Exception in thread "main" java.io.IOException
 * Caused by: com.rabbitmq.client.ShutdownSignalException:channel error; protocol method: #method<channel.close>
 *(reply-code=404, reply-text=NOT_FOUND - no queue 'ask_queue' in vhost '/', class-id=60, method-id=20)


错误原因

:生产者没有开启,或者生产者的队列名和此消费者的队列名QUEUE_NAME不同导致的


解决办法

:开启生产者和修改队列名一样



4、 第三个参数为true报了如下错误

channel.queueDeclare(QUEUE_NAME,false,true,false,null);


解决办法

:第三个参数修改为false

channel.queueDeclare(QUEUE_NAME,false,false,false,null);

第三个参数为true报了如下错误:
       * Exception in thread "main" 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.ChannelN.queueDeclare(ChannelN.java:968)
       * 	at com.rabbitmq.client.impl.recovery.AutorecoveringChannel.queueDeclare(AutorecoveringChannel.java:343)
       * 	at com.feng.rabbitmq.two.Task01.main(Task01.java:14)
       * Caused by: com.rabbitmq.client.ShutdownSignalException: channel error; protocol method: #method<channel.close>(reply-code=405, reply-text=RESOURCE_LOCKED - cannot obtain exclusive access to locked queue 'hello' in vhost '/'. It could be originally declared on another connection or the exclusive property value does not match that of the original declaration., class-id=50, method-id=10)
       * 	at com.rabbitmq.utility.ValueOrException.getValue(ValueOrException.java:66)
       */



版权声明:本文为qq_43987149原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。