[jboss-user] [JBoss Messaging] - Re: JBoss Messaging - classcast exception

prabhun do-not-reply at jboss.com
Wed Oct 8 12:07:01 EDT 2008


Thanks Andy and Clebert ,

In our case
Object A is a publisher, which publishes the messages to a JMStopic. And Object B and C are the subscribers which use their own scoped class loaders.
If I use the same class loader for both B and C it works fine. It fails only when the class loaders are different.
As mentioned in the post forwarded by Clebert , we do use getObject call like below,

In the first subscriber,

 javax.jms.ObjectMessage objectMessageA = (javax.jms.ObjectMessage)message;

Object aObject = objectMessageA.getObject(); 
ObjectA  a = (ObjectA)aObject; -- (1)
It works fine.

In next subscriber

 javax.jms.ObjectMessage objectMessageB = (javax.jms.ObjectMessage)message;

Object bObject = objectMessageB.getObject(); 
ObjectA  b = (ObjectA)bObject; -- (2)
This fails if we have a different class loader for the second subsriber.

Is there any other way to use the getObject call to avoid this exception?

Regards,
Prabhu



View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4181064#4181064

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4181064



More information about the jboss-user mailing list