Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Execution of Rabbit message listener failed. #2

Open
Antares070 opened this issue Dec 27, 2019 · 2 comments
Open

Execution of Rabbit message listener failed. #2

Antares070 opened this issue Dec 27, 2019 · 2 comments
Assignees

Comments

@Antares070
Copy link

Antares070 commented Dec 27, 2019

Hi,
First of all, thanks for your book, very good example and explanations.
I've got the following issue: When running v5 and trying to send a message to the gamification service I've got the following error:

2019-12-27 20:49:54.300  WARN 17720 --- [cTaskExecutor-1] s.a.r.l.ConditionalRejectingErrorHandler : Execution of Rabbit message listener failed.

org.springframework.amqp.rabbit.listener.exception.ListenerExecutionFailedException: Listener method could not be invoked with the incoming message
Endpoint handler details:
Method [void microservices.book.gamification.event.EventHandler.handleMultiplicationSolved(microservices.book.gamification.event.MultiplicationSolvedEvent)]
Bean [microservices.book.gamification.event.EventHandler@3cc053]
	at org.springframework.amqp.rabbit.listener.adapter.MessagingMessageListenerAdapter.invokeHandler(MessagingMessageListenerAdapter.java:129) ~[spring-rabbit-1.7.4.RELEASE.jar:na]
	at org.springframework.amqp.rabbit.listener.adapter.MessagingMessageListenerAdapter.onMessage(MessagingMessageListenerAdapter.java:106) ~[spring-rabbit-1.7.4.RELEASE.jar:na]
	at org.springframework.amqp.rabbit.listener.AbstractMessageListenerContainer.doInvokeListener(AbstractMessageListenerContainer.java:848) ~[spring-rabbit-1.7.4.RELEASE.jar:na]
	at org.springframework.amqp.rabbit.listener.AbstractMessageListenerContainer.invokeListener(AbstractMessageListenerContainer.java:771) ~[spring-rabbit-1.7.4.RELEASE.jar:na]
	at org.springframework.amqp.rabbit.listener.SimpleMessageListenerContainer.access$001(SimpleMessageListenerContainer.java:102) [spring-rabbit-1.7.4.RELEASE.jar:na]
	at org.springframework.amqp.rabbit.listener.SimpleMessageListenerContainer$1.invokeListener(SimpleMessageListenerContainer.java:198) ~[spring-rabbit-1.7.4.RELEASE.jar:na]
	at org.springframework.amqp.rabbit.listener.SimpleMessageListenerContainer.invokeListener(SimpleMessageListenerContainer.java:1311) [spring-rabbit-1.7.4.RELEASE.jar:na]
	at org.springframework.amqp.rabbit.listener.AbstractMessageListenerContainer.executeListener(AbstractMessageListenerContainer.java:752) ~[spring-rabbit-1.7.4.RELEASE.jar:na]
	at org.springframework.amqp.rabbit.listener.SimpleMessageListenerContainer.doReceiveAndExecute(SimpleMessageListenerContainer.java:1254) [spring-rabbit-1.7.4.RELEASE.jar:na]
	at org.springframework.amqp.rabbit.listener.SimpleMessageListenerContainer.receiveAndExecute(SimpleMessageListenerContainer.java:1224) [spring-rabbit-1.7.4.RELEASE.jar:na]
	at org.springframework.amqp.rabbit.listener.SimpleMessageListenerContainer.access$1600(SimpleMessageListenerContainer.java:102) [spring-rabbit-1.7.4.RELEASE.jar:na]
	at org.springframework.amqp.rabbit.listener.SimpleMessageListenerContainer$AsyncMessageProcessingConsumer.run(SimpleMessageListenerContainer.java:1470) [spring-rabbit-1.7.4.RELEASE.jar:na]
	at java.lang.Thread.run(Thread.java:748) [na:1.8.0_171]
Caused by: org.springframework.amqp.support.converter.MessageConversionException: Cannot handle message
	... 13 common frames omitted
Caused by: org.springframework.messaging.converter.MessageConversionException: Could not read JSON: Can not construct instance of microservices.book.gamification.event.MultiplicationSolvedEvent: no suitable constructor found, can not deserialize from Object value (missing default constructor or creator, or perhaps need to add/enable type information?)
 at [Source: [B@4e01d3cc; line: 1, column: 2]; nested exception is com.fasterxml.jackson.databind.JsonMappingException: Can not construct instance of microservices.book.gamification.event.MultiplicationSolvedEvent: no suitable constructor found, can not deserialize from Object value (missing default constructor or creator, or perhaps need to add/enable type information?)
 at [Source: [B@4e01d3cc; line: 1, column: 2]
	at org.springframework.messaging.converter.MappingJackson2MessageConverter.convertFromInternal(MappingJackson2MessageConverter.java:228) ~[spring-messaging-4.3.11.RELEASE.jar:4.3.11.RELEASE]
	at org.springframework.messaging.converter.AbstractMessageConverter.fromMessage(AbstractMessageConverter.java:175) ~[spring-messaging-4.3.11.RELEASE.jar:4.3.11.RELEASE]
	at org.springframework.messaging.handler.annotation.support.PayloadArgumentResolver.resolveArgument(PayloadArgumentResolver.java:135) ~[spring-messaging-4.3.11.RELEASE.jar:4.3.11.RELEASE]
	at org.springframework.messaging.handler.invocation.HandlerMethodArgumentResolverComposite.resolveArgument(HandlerMethodArgumentResolverComposite.java:112) ~[spring-messaging-4.3.11.RELEASE.jar:4.3.11.RELEASE]
	at org.springframework.messaging.handler.invocation.InvocableHandlerMethod.getMethodArgumentValues(InvocableHandlerMethod.java:135) ~[spring-messaging-4.3.11.RELEASE.jar:4.3.11.RELEASE]
	at org.springframework.messaging.handler.invocation.InvocableHandlerMethod.invoke(InvocableHandlerMethod.java:107) ~[spring-messaging-4.3.11.RELEASE.jar:4.3.11.RELEASE]
	at org.springframework.amqp.rabbit.listener.adapter.HandlerAdapter.invoke(HandlerAdapter.java:49) ~[spring-rabbit-1.7.4.RELEASE.jar:na]
	at org.springframework.amqp.rabbit.listener.adapter.MessagingMessageListenerAdapter.invokeHandler(MessagingMessageListenerAdapter.java:126) ~[spring-rabbit-1.7.4.RELEASE.jar:na]
	... 12 common frames omitted
Caused by: com.fasterxml.jackson.databind.JsonMappingException: Can not construct instance of microservices.book.gamification.event.MultiplicationSolvedEvent: no suitable constructor found, can not deserialize from Object value (missing default constructor or creator, or perhaps need to add/enable type information?)
 at [Source: [B@4e01d3cc; line: 1, column: 2]
	at com.fasterxml.jackson.databind.JsonMappingException.from(JsonMappingException.java:270) ~[jackson-databind-2.8.10.jar:2.8.10]
	at com.fasterxml.jackson.databind.DeserializationContext.instantiationException(DeserializationContext.java:1456) ~[jackson-databind-2.8.10.jar:2.8.10]
	at com.fasterxml.jackson.databind.DeserializationContext.handleMissingInstantiator(DeserializationContext.java:1012) ~[jackson-databind-2.8.10.jar:2.8.10]
	at com.fasterxml.jackson.databind.deser.BeanDeserializerBase.deserializeFromObjectUsingNonDefault(BeanDeserializerBase.java:1206) ~[jackson-databind-2.8.10.jar:2.8.10]
	at com.fasterxml.jackson.databind.deser.BeanDeserializer.deserializeFromObject(BeanDeserializer.java:314) ~[jackson-databind-2.8.10.jar:2.8.10]
	at com.fasterxml.jackson.databind.deser.BeanDeserializer.deserialize(BeanDeserializer.java:148) ~[jackson-databind-2.8.10.jar:2.8.10]
	at com.fasterxml.jackson.databind.ObjectMapper._readMapAndClose(ObjectMapper.java:3814) ~[jackson-databind-2.8.10.jar:2.8.10]
	at com.fasterxml.jackson.databind.ObjectMapper.readValue(ObjectMapper.java:2975) ~[jackson-databind-2.8.10.jar:2.8.10]
	at org.springframework.messaging.converter.MappingJackson2MessageConverter.convertFromInternal(MappingJackson2MessageConverter.java:215) ~[spring-messaging-4.3.11.RELEASE.jar:4.3.11.RELEASE]
	... 19 common frames omitted

2019-12-27 20:49:54.301  WARN 17720 --- [cTaskExecutor-1] ingErrorHandler$DefaultExceptionStrategy : Fatal message conversion error; message rejected; it will be dropped or routed to a dead letter exchange, if so configured: (Body:'{"multiplicationResultAttemptId":20,"userId":1,"correct":false}' MessageProperties [headers={__TypeId__=microservices.book.multiplication.event.MultiplicationSolvedEvent}, timestamp=null, messageId=null, userId=null, receivedUserId=null, appId=null, clusterId=null, type=null, correlationId=null, correlationIdString=null, replyTo=null, contentType=application/json, contentEncoding=UTF-8, contentLength=0, deliveryMode=null, receivedDeliveryMode=PERSISTENT, expiration=null, priority=0, redelivered=false, receivedExchange=multiplication_exchange, receivedRoutingKey=multiplication.solved, receivedDelay=null, deliveryTag=2, messageCount=0, consumerTag=amq.ctag-OFp8gKAjXgnxmVtBxqb5JQ, consumerQueue=gamification_multiplication_queue])

I've checked RabbitMQ is started and enabled plugins, I have the updated versions of multitiplication/gamification v5 but I don´t get where is the cause.
Would your please help me?.
Thank you in advance.

@mechero
Copy link
Contributor

mechero commented Dec 28, 2019

Hi! I'm glad you're enjoying the book! 😄

Please check #1 (comment), there is some new behavior with lombok which requires extra config.

Let me know if that helps.

@mechero mechero self-assigned this Dec 28, 2019
@Antares070
Copy link
Author

Hi! I'm glad you're enjoying the book! 😄

Please check #1 (comment), there is some new behavior with lombok which requires extra config.

Let me know if that helps.

Thanks a lot for your quick reply which has helped me a lot!.
I`ve created lombok.config including this line:
lombok.anyConstructor.addConstructorProperties=true
And it works as you comment, thank you!.
P.D. Sorry I hadn't checked the comment about it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants