This is a bug, as mentioned in this thread http://community.jboss.org/message/517604#517604 , allthough supposedly it has been fixed in JBoss 5.0.1 GA.
The workaround which I am using is mentioned in the thread, but here it is again:
{code}
logger.info("ObjectMessage Detected");
Student st = null;
// get the current TCCL
ClassLoader originalTCCL = Thread.currentThread().getContextClassLoader();
try
{
// temporarily change TCCL
Thread.currentThread().setContextClassLoader(this.getClass().getClassLoader());
ObjectMessage om = (ObjectMessage) message;
logger.info("ObjectMessage Created");
Student s = (Student) om.getObject();
logger.info("Student created");
logger.info(s.toString());
}
catch (Exception e)
{
e.printStackTrace();
}
finally
{
// set back the original TCCL
Thread.currentThread().setContextClassLoader(originalTCCL);
}
logger.info("Object Message : "+st.toString());
{code}