发送消息,后台报错

来源:7-4 Spring Cloud Stream的使用(上)

慕粉1462372119

2018-03-23

使用stream rabbitmq,通过streamclient发送消息,后台报错,rabbitmq管理界面看到没有正常消费消息。

后台报错如下:

2018-03-23 17:37:42.334  INFO 13872 --- [nio-8082-exec-6] com.imooc.order.message.StreamReceiver   : StreamReceiver: now: Fri Mar 23 17:37:42 CST 2018

2018-03-23 17:38:09.053  WARN 13872 --- [Message.order-1] o.s.a.r.r.RejectAndDontRequeueRecoverer  : Retries exhausted for message (Body:'[B@4d5ea961(byte[33])' MessageProperties [headers={contentType=text/plain}, contentType=application/octet-stream, contentLength=0, receivedDeliveryMode=PERSISTENT, priority=0, redelivered=false, receivedExchange=myMessage, receivedRoutingKey=myMessage, deliveryTag=4, consumerTag=amq.ctag-Yl3iZiIlUiftFbLnkEJD6g, consumerQueue=myMessage.order])

org.springframework.amqp.rabbit.listener.exception.ListenerExecutionFailedException: Listener threw exception

at org.springframework.amqp.rabbit.listener.AbstractMessageListenerContainer.wrapToListenerExecutionFailedExceptionIfNeeded(AbstractMessageListenerContainer.java:1474) ~[spring-rabbit-2.0.0.M5.jar:na]

at org.springframework.amqp.rabbit.listener.AbstractMessageListenerContainer.doInvokeListener(AbstractMessageListenerContainer.java:1385) ~[spring-rabbit-2.0.0.M5.jar:na]

at org.springframework.amqp.rabbit.listener.AbstractMessageListenerContainer.actualInvokeListener(AbstractMessageListenerContainer.java:1305) ~[spring-rabbit-2.0.0.M5.jar:na]

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_151]

at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_151]

at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_151]

at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_151]

at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:338) ~[spring-aop-5.0.0.RC3.jar:5.0.0.RC3]

at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:197) ~[spring-aop-5.0.0.RC3.jar:5.0.0.RC3]

at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:163) ~[spring-aop-5.0.0.RC3.jar:5.0.0.RC3]

at org.springframework.retry.interceptor.RetryOperationsInterceptor$1.doWithRetry(RetryOperationsInterceptor.java:91) ~[spring-retry-1.2.1.RELEASE.jar:na]

at org.springframework.retry.support.RetryTemplate.doExecute(RetryTemplate.java:287) [spring-retry-1.2.1.RELEASE.jar:na]

at org.springframework.retry.support.RetryTemplate.execute(RetryTemplate.java:180) [spring-retry-1.2.1.RELEASE.jar:na]

at org.springframework.retry.interceptor.RetryOperationsInterceptor.invoke(RetryOperationsInterceptor.java:115) ~[spring-retry-1.2.1.RELEASE.jar:na]

at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:185) ~[spring-aop-5.0.0.RC3.jar:5.0.0.RC3]

at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:212) ~[spring-aop-5.0.0.RC3.jar:5.0.0.RC3]

at org.springframework.amqp.rabbit.listener.$Proxy185.invokeListener(Unknown Source) ~[na:na]

at org.springframework.amqp.rabbit.listener.AbstractMessageListenerContainer.invokeListener(AbstractMessageListenerContainer.java:1292) ~[spring-rabbit-2.0.0.M5.jar:na]

at org.springframework.amqp.rabbit.listener.AbstractMessageListenerContainer.executeListener(AbstractMessageListenerContainer.java:1271) ~[spring-rabbit-2.0.0.M5.jar:na]

at org.springframework.amqp.rabbit.listener.SimpleMessageListenerContainer.doReceiveAndExecute(SimpleMessageListenerContainer.java:746) ~[spring-rabbit-2.0.0.M5.jar:na]

at org.springframework.amqp.rabbit.listener.SimpleMessageListenerContainer.receiveAndExecute(SimpleMessageListenerContainer.java:730) ~[spring-rabbit-2.0.0.M5.jar:na]

at org.springframework.amqp.rabbit.listener.SimpleMessageListenerContainer.access$500(SimpleMessageListenerContainer.java:74) ~[spring-rabbit-2.0.0.M5.jar:na]

at org.springframework.amqp.rabbit.listener.SimpleMessageListenerContainer$AsyncMessageProcessingConsumer.run(SimpleMessageListenerContainer.java:945) ~[spring-rabbit-2.0.0.M5.jar:na]

at java.lang.Thread.run(Thread.java:748) ~[na:1.8.0_151]

Caused by: org.springframework.messaging.MessageDeliveryException: Dispatcher has no subscribers for channel 'unknown.channel.name'.; nested exception is org.springframework.integration.MessageDispatchingException: Dispatcher has no subscribers, failedMessage=GenericMessage [payload=now: Fri Mar 23 17:38:06 CST 2018, headers={amqp_receivedDeliveryMode=PERSISTENT, amqp_receivedRoutingKey=myMessage, amqp_receivedExchange=myMessage, amqp_deliveryTag=4, amqp_consumerQueue=myMessage.order, amqp_redelivered=false, id=45734ca8-b711-4ab6-e64e-43bb8b694a33, amqp_consumerTag=amq.ctag-Yl3iZiIlUiftFbLnkEJD6g, contentType=text/plain, timestamp=1521797889052}]

at org.springframework.integration.channel.AbstractSubscribableChannel.doSend(AbstractSubscribableChannel.java:77) ~[spring-integration-core-5.0.0.M6.jar:5.0.0.M6]

at org.springframework.integration.channel.AbstractMessageChannel.send(AbstractMessageChannel.java:423) ~[spring-integration-core-5.0.0.M6.jar:5.0.0.M6]

at org.springframework.integration.channel.AbstractMessageChannel.send(AbstractMessageChannel.java:373) ~[spring-integration-core-5.0.0.M6.jar:5.0.0.M6]

at org.springframework.messaging.core.GenericMessagingTemplate.doSend(GenericMessagingTemplate.java:183) ~[spring-messaging-5.0.0.RC3.jar:5.0.0.RC3]

at org.springframework.messaging.core.GenericMessagingTemplate.doSend(GenericMessagingTemplate.java:162) ~[spring-messaging-5.0.0.RC3.jar:5.0.0.RC3]

at org.springframework.messaging.core.GenericMessagingTemplate.doSend(GenericMessagingTemplate.java:47) ~[spring-messaging-5.0.0.RC3.jar:5.0.0.RC3]

at org.springframework.messaging.core.AbstractMessageSendingTemplate.send(AbstractMessageSendingTemplate.java:108) ~[spring-messaging-5.0.0.RC3.jar:5.0.0.RC3]

at org.springframework.integration.handler.AbstractMessageProducingHandler.sendOutput(AbstractMessageProducingHandler.java:393) ~[spring-integration-core-5.0.0.M6.jar:5.0.0.M6]

at org.springframework.integration.handler.AbstractMessageProducingHandler.produceOutput(AbstractMessageProducingHandler.java:304) ~[spring-integration-core-5.0.0.M6.jar:5.0.0.M6]

at org.springframework.integration.handler.AbstractMessageProducingHandler.sendOutputs(AbstractMessageProducingHandler.java:195) ~[spring-integration-core-5.0.0.M6.jar:5.0.0.M6]

at org.springframework.integration.handler.AbstractReplyProducingMessageHandler.handleMessageInternal(AbstractReplyProducingMessageHandler.java:115) ~[spring-integration-core-5.0.0.M6.jar:5.0.0.M6]

at org.springframework.integration.handler.AbstractMessageHandler.handleMessage(AbstractMessageHandler.java:132) ~[spring-integration-core-5.0.0.M6.jar:5.0.0.M6]

at org.springframework.integration.channel.FixedSubscriberChannel.send(FixedSubscriberChannel.java:70) ~[spring-integration-core-5.0.0.M6.jar:5.0.0.M6]

at org.springframework.integration.channel.FixedSubscriberChannel.send(FixedSubscriberChannel.java:64) ~[spring-integration-core-5.0.0.M6.jar:5.0.0.M6]

at org.springframework.messaging.core.GenericMessagingTemplate.doSend(GenericMessagingTemplate.java:183) ~[spring-messaging-5.0.0.RC3.jar:5.0.0.RC3]

at org.springframework.messaging.core.GenericMessagingTemplate.doSend(GenericMessagingTemplate.java:162) ~[spring-messaging-5.0.0.RC3.jar:5.0.0.RC3]

at org.springframework.messaging.core.GenericMessagingTemplate.doSend(GenericMessagingTemplate.java:47) ~[spring-messaging-5.0.0.RC3.jar:5.0.0.RC3]

at org.springframework.messaging.core.AbstractMessageSendingTemplate.send(AbstractMessageSendingTemplate.java:108) ~[spring-messaging-5.0.0.RC3.jar:5.0.0.RC3]

at org.springframework.integration.endpoint.MessageProducerSupport.sendMessage(MessageProducerSupport.java:188) ~[spring-integration-core-5.0.0.M6.jar:5.0.0.M6]

at org.springframework.integration.amqp.inbound.AmqpInboundChannelAdapter.access$1000(AmqpInboundChannelAdapter.java:56) ~[spring-integration-amqp-5.0.0.M6.jar:5.0.0.M6]

at org.springframework.integration.amqp.inbound.AmqpInboundChannelAdapter$Listener.processMessage(AmqpInboundChannelAdapter.java:242) ~[spring-integration-amqp-5.0.0.M6.jar:5.0.0.M6]

at org.springframework.integration.amqp.inbound.AmqpInboundChannelAdapter$Listener.onMessage(AmqpInboundChannelAdapter.java:203) ~[spring-integration-amqp-5.0.0.M6.jar:5.0.0.M6]

at org.springframework.amqp.rabbit.listener.AbstractMessageListenerContainer.doInvokeListener(AbstractMessageListenerContainer.java:1382) ~[spring-rabbit-2.0.0.M5.jar:na]

... 22 common frames omitted

Caused by: org.springframework.integration.MessageDispatchingException: Dispatcher has no subscribers

at org.springframework.integration.dispatcher.UnicastingDispatcher.doDispatch(UnicastingDispatcher.java:138) ~[spring-integration-core-5.0.0.M6.jar:5.0.0.M6]

at org.springframework.integration.dispatcher.UnicastingDispatcher.dispatch(UnicastingDispatcher.java:105) ~[spring-integration-core-5.0.0.M6.jar:5.0.0.M6]

at org.springframework.integration.channel.AbstractSubscribableChannel.doSend(AbstractSubscribableChannel.java:73) ~[spring-integration-core-5.0.0.M6.jar:5.0.0.M6]

... 44 common frames omitted

2018-03-23 17:38:09.057  WARN 13872 --- [Message.order-1] s.a.r.l.ConditionalRejectingErrorHandler : Execution of Rabbit message listener failed.


rabbitmq管理界面如下图

//img.mukewang.com/szimg/5ab4cb870001456009150586.jpg

这是什么原因呢?是因为网速太卡还是的环境有问题,我用的rabbitmq是装在虚拟机上的。

写回答

1回答

廖师兄

2018-03-27

配置了type是json吗?用我的代码运行看看

0
6
慕粉1462372119
回复
廖师兄
可能是我的rabbitmq安装有点问题,一般不会碰到这种情况
2018-11-27
共6条回复

SpringCloud Finchley(M2+RELEASE+SR2)微服务实战

SpringCloud组件实现微服务,【已升级Finchley.Release】

5670 学习 · 2489 问题

查看课程