-
1. Re: Can't produce JAXB object messages
davsclaus May 3, 2012 10:00 AM (in response to simplex-software)Are you sending JAXB objects over JMS as javax.jms.ObjectMessage. Or are you sending the message in plain XML which is a javax.jmx.TextMessage.
eg if you send plain XML then JAXB can turn that XML into a JAXB object for you.
If you send objects over JMS then make sure the JAXB classes are on both sides, eg on the producer and consumer sides. And that they are serializable compatible. eg usually the same version/JAR etc.
-
2. Re: Can't produce JAXB object messages
simplex-software May 4, 2012 6:50 AM (in response to davsclaus)I'm sending javax.jms.ObjectMessage. These objects classes are XJC generated and, since I didn't manage to get the JAXB binding generating "implements Serializable", I extended them in mine classes which ony implement serializable. I stored messages in a JMS queue after having initialized the object. The consumer retrieves messages but it finds them as if they weren't intialized. Both the producer and the consumer are in the same bundle deployed on Karaf.
Instead of extending the JAXB classes I just copied their attributes in mine ones, provided the getters/setters, implement Serializable and removed extends ...
This has solved the problem. But I don't understand why is that.
Kind regards,
Nicolas
-
3. Re: Can't produce JAXB object messages
ffang May 4, 2012 8:05 AM (in response to simplex-software)Hi,
I think this is just how java serialization works.
I guess your jaxb object has some non-serializable field, If so, take a look at to get more details.
Why not add JAXB binding to generate "implements Serializable" jaxb object?
http://stackoverflow.com/questions/95181/java-serialization-with-non-serializable-parts
Freeman