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

Better Exception Message for JMS Jackson Converter Error [SPR-14672] #19236

Closed
spring-issuemaster opened this issue Sep 6, 2016 · 1 comment
Closed

Comments

@spring-issuemaster
Copy link
Collaborator

@spring-issuemaster spring-issuemaster commented Sep 6, 2016

Michael Böckling opened SPR-14672 and commented

In org.springframework.jms.support.converter.MappingJackson2MessageConverter#getJavaTypeForMessage, an exception is thrown if a message lacks the property that has been configured as the typeIdPropertyName, and thus Jackson has no idea to which Java type to map the message to.

The error message is "Could not find type id property [" + this.typeIdPropertyName + "]", which lacks sufficient diagnostic context to really track down the issue once it appears in a logfile. It would be very useful to have the name of the JMS queue, so I can make a guess which application forgot to set that ID.
The Message ID might also be useful for some cases.

Proposal:

protected JavaType getJavaTypeForMessage(Message message) throws JMSException {
     String typeId = message.getStringProperty(this.typeIdPropertyName);
     if (typeId == null) {
          throw new MessageConversionException("Could not find type id property [" + this.typeIdPropertyName + "] on message " + message.getJMSMessageID() + " from destination " + message.getJMSDestination().toString());
     }

Affects: 4.2.6

Backported to: 4.2.8

@spring-issuemaster

This comment has been minimized.

Copy link
Collaborator Author

@spring-issuemaster spring-issuemaster commented Sep 9, 2016

Juergen Hoeller commented

Good catch! I've extended the message to refer to the message id and to the message's original destination as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.