I am using Java EE JMS Queue. I send objects to the queue and then get them using MDB. When reading the message body (with getBody ()) into the object, the following exception occurs:
javax.jms.MessageFormatException: Body not assignable to class ...
Is there a way to get a more descriptive error from this that will explain why it cannot be assigned? I also tried to enter debug mode and see which message object arrives in MDB, but it is serialized as far as I can see, so it is not very useful.
The type of object is properly recognized in the debugger before it is sent to the queue.
Additional information: if I create an empty object manually and send it, it will be correctly recognized. The production object comes from the REST endpoint and contains many properties and is transformed in the process. Some of the data should interfere with the assignment, but debugging each property step by step would be a pain and only as a last resort.
The object is confirmed serializable for each answer in how to test in Java that the class implements Serializable correctly (not just an instance of Serializable)
The object is sent as: jmsContext.createProducer().send(queue, object);
I managed to narrow it down by setting all the properties to null and then commenting it out one by one until it works. Turns out a property of type Duration was wrong? what caused the problem. And in another case, it called the XMLGregorianCalendar property. However, this is a very hacky way of debugging, and I still donβt know why the assignment fails, I just know which property calls it.
Currently, I have finished queuing entity identifiers instead of complete objects, and instead I am returning them from the database by identifier.
Pastebin full stacktrace: http://pastebin.com/vWvhDTcr
java debugging java-ee jms
cen
source share