解决org.springframework.amqp.AmqpException: No method found for class [B 问题
程序员文章站
2022-07-15 11:18:39
...
spring-boot在集成rabbitmq时,如果使用 amqp-client 发送消息,@RabbitListener会一直循环报错
org.springframework.amqp.rabbit.listener.exception.ListenerExecutionFailedException: Listener method 'no match' threw exception
at org.springframework.amqp.rabbit.listener.adapter.MessagingMessageListenerAdapter.invokeHandler(MessagingMessageListenerAdapter.java:198) ~[spring-rabbit-2.1.2.RELEASE.jar:2.1.2.RELEASE]
at org.springframework.amqp.rabbit.listener.adapter.MessagingMessageListenerAdapter.onMessage(MessagingMessageListenerAdapter.java:127) ~[spring-rabbit-2.1.2.RELEASE.jar:2.1.2.RELEASE]
at org.springframework.amqp.rabbit.listener.AbstractMessageListenerContainer.doInvokeListener(AbstractMessageListenerContainer.java:1521) ~[spring-rabbit-2.1.2.RELEASE.jar:2.1.2.RELEASE]
at org.springframework.amqp.rabbit.listener.AbstractMessageListenerContainer.actualInvokeListener(AbstractMessageListenerContainer.java:1444) ~[spring-rabbit-2.1.2.RELEASE.jar:2.1.2.RELEASE]
at org.springframework.amqp.rabbit.listener.AbstractMessageListenerContainer.invokeListener(AbstractMessageListenerContainer.java:1431) ~[spring-rabbit-2.1.2.RELEASE.jar:2.1.2.RELEASE]
at org.springframework.amqp.rabbit.listener.AbstractMessageListenerContainer.executeListener(AbstractMessageListenerContainer.java:1410) ~[spring-rabbit-2.1.2.RELEASE.jar:2.1.2.RELEASE]
at org.springframework.amqp.rabbit.listener.SimpleMessageListenerContainer.doReceiveAndExecute(SimpleMessageListenerContainer.java:848) [spring-rabbit-2.1.2.RELEASE.jar:2.1.2.RELEASE]
at org.springframework.amqp.rabbit.listener.SimpleMessageListenerContainer.receiveAndExecute(SimpleMessageListenerContainer.java:832) [spring-rabbit-2.1.2.RELEASE.jar:2.1.2.RELEASE]
at org.springframework.amqp.rabbit.listener.SimpleMessageListenerContainer.access$700(SimpleMessageListenerContainer.java:78) [spring-rabbit-2.1.2.RELEASE.jar:2.1.2.RELEASE]
at org.springframework.amqp.rabbit.listener.SimpleMessageListenerContainer$AsyncMessageProcessingConsumer.run(SimpleMessageListenerContainer.java:1073) [spring-rabbit-2.1.2.RELEASE.jar:2.1.2.RELEASE]
at java.lang.Thread.run(Thread.java:748) [na:1.8.0_152]
Caused by: org.springframework.amqp.AmqpException: No method found for class [B
at org.springframework.amqp.rabbit.listener.adapter.DelegatingInvocableHandler.getHandlerForPayload(DelegatingInvocableHandler.java:149) ~[spring-rabbit-2.1.2.RELEASE.jar:2.1.2.RELEASE]
at org.springframework.amqp.rabbit.listener.adapter.DelegatingInvocableHandler.invoke(DelegatingInvocableHandler.java:129) ~[spring-rabbit-2.1.2.RELEASE.jar:2.1.2.RELEASE]
at org.springframework.amqp.rabbit.listener.adapter.HandlerAdapter.invoke(HandlerAdapter.java:60) ~[spring-rabbit-2.1.2.RELEASE.jar:2.1.2.RELEASE]
at org.springframework.amqp.rabbit.listener.adapter.MessagingMessageListenerAdapter.invokeHandler(MessagingMessageListenerAdapter.java:190) ~[spring-rabbit-2.1.2.RELEASE.jar:2.1.2.RELEASE]
以上是报错信息。
是因为你生产者传过去的实体类对象需要实现序列化 implements Serializable。
如果还是一样的错,你就得去RabbitMQ客户端上的队列消息先删除,因为那些队列消息还是原先的错误的消息。你再重新开程序,就没问题了。
上一篇: 三大组件之Listener:监听器(模仿springmvc框架监听器)
下一篇: 大三笔记
推荐阅读
-
Caused by: org.springframework.amqp.AmqpException: No method found for class [B
-
解决org.springframework.amqp.AmqpException: No method found for class [B 问题
-
org.springframework.amqp.AmqpException: No method found for class [B
-
解决rabbitmq无限循环异常问题亲测 Caused by: org.springframework.amqp.AmqpException: No method found for class [B
-
为什么有PHP Class SoapClient not found问题以及解决方法
-
解决 Hibernate Annotation 的 "no persistent classes found for query class" 问题 HibernateJavaAntApacheIDEA
-
解决 Hibernate Annotation 的 "no persistent classes found for query class" 问题 HibernateJavaAntApacheIDEA
-
解决 Hibernate Annotation 的 "no persistent classes found for query class" 问题 HibernateJavaAntApacheIDEA
-
解决 Hibernate Annotation 的 "no persistent classes found for query class" 问题 HibernateJavaAntApacheIDEA
-
JPA Failed to create query for method public abstract;No property xxx found for type xxx问题解决