Hey, thanks for the quick reply...
I send the object in the following way at the server using Spring's JmsTemplate...
Code:
public void sendObjectsAsMessages(MyObject obj) {
...
class MessageNotifier implements MessageCreator{
private MyObject obj;
public MessageNotifier(MyObject obj) {
this.obj = obj;
}
public Message createMessage(Session session)
throws JMSException {
ObjectMessage message = session.createObjectMessage();
message.setObject(ticket);
return message;
}
}
MessageNotifier msgCrtr = new MessageNotifier(obj);
jmsTemplate.send(myDestination, msgCrtr);
}
Again, this all works great with simple objects. With objects that contained collections, I was hanging on the following code:
Code:
public void onMessage(Message msg) {
try {
ObjectMessage objMsg = (ObjectMessage) msg;
MyObject obj = (MyObject) objMsg.getObject();
... My Implimentation Details...
} catch (Exception e) {
e.printStackTrace();
}
}
The actual error was a ClassCastException, but this was because the object returned on
getObject() was a JmsException. When I was debugging, I stepped in and saw that the JmsException had an embedded java.io.IoException on net.sf.hibernate.Set.
However, for some reason, now when I send the ObjectMessage, it isn't even getting to the Queue. So the
onMessage() of my listener isn't even getting triggered.
Now, just a note. If I create a new
MyObject that isn't retrieved by Hibernate, the object gets serialized and deserialized with no problems. <shrug>
Thanks,
James