RabbitMQ出现com.rabbitmq.client.ShutdownSignalException: channel error protocol method:问题

RabbitMQ做完前面的几种模式后,做到路由模式出现以下报错:

Exception in thread "main" java.io.IOException
	at com.rabbitmq.client.impl.AMQChannel.wrap(AMQChannel.java:126)
	at com.rabbitmq.client.impl.AMQChannel.wrap(AMQChannel.java:122)
	at com.rabbitmq.client.impl.AMQChannel.exnWrappingRpc(AMQChannel.java:144)
	at com.rabbitmq.client.impl.ChannelN.exchangeDeclare(ChannelN.java:777)
	at com.rabbitmq.client.impl.recovery.AutorecoveringChannel.exchangeDeclare(AutorecoveringChannel.java:237)
	at com.rabbitmq.client.impl.recovery.AutorecoveringChannel.exchangeDeclare(AutorecoveringChannel.java:227)
	at com.rabbitmq.client.impl.recovery.AutorecoveringChannel.exchangeDeclare(AutorecoveringChannel.java:207)
	at com.rabbitmq.client.impl.recovery.AutorecoveringChannel.exchangeDeclare(AutorecoveringChannel.java:212)
	at com.example.rabbitmq.routing.Producer.main(Producer.java:39)
Caused by: com.rabbitmq.client.ShutdownSignalException: channel error; protocol method: #method<channel.close>(reply-code=406, reply-text=PRECONDITION_FAILED - inequivalent arg 'type' for exchange 'direct_exchange' in vhost '/': received 'direct' but current is 'fanout', class-id=40, method-id=10)
	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:494)
	at com.rabbitmq.client.impl.AMQChannel.privateRpc(AMQChannel.java:288)
	at com.rabbitmq.client.impl.AMQChannel.exnWrappingRpc(AMQChannel.java:138)
	... 6 more

解决方案:

找到三个答案 供参考

1、交换机类型不同(代码原因)
  大概意思是交换机的类型不匹配,消费端应该收到名称为“DIRECT_EXCHANGE”,类型为“fanout”的交换机发送的消息,但是当前RabbitMQ中存在的名称为“DIRECT_EXCHANGE”的交换机的类型却是“direct”,所以交换机的类型不匹配。

2、交换机类型不同(缓存原因)
Rabbitmq服务通道是持久通道,该queue 已经存在, 而且通道属性跟最近修改后的属性不一致,而导致无法更新queue.

  解决办法
进入rabbitmq-management 将Queue或者Exchanges删除即可.

3 、权限不足
  解决方法如下:RabbitMQ出现com.rabbitmq.client.ShutdownSignalException: channel error protocol method:问题_第1张图片
RabbitMQ出现com.rabbitmq.client.ShutdownSignalException: channel error protocol method:问题_第2张图片

你可能感兴趣的:(报错汇总)