JBoss Community

Re: MDB - Obejctmessage exception

created by Michael Brown in JBoss Messaging - View the full discussion

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}

Reply to this message by going to Community

Start a new discussion in JBoss Messaging at Community