I'm kind of in a bind, and I'm hoping someone will nudge me in the right direction...
 
I have MQSeries working quite well with JBoss (with MDBs and all), but I'm having one problem. When I use an ObjectMessage, I get an exception on the call to getObject(). The exception is ultimately a ClassNotFoundException coming out of MQ when it attempts to deserialize the contained object.
 
Here's the MQ Series ObjectMessage implementation that throws the ClassNotFoundException:
 
  ByteArrayInputStream bytearrayinputstream = new ByteArrayInputStream(messageBytes, dataStart, messageBytes.length - dataStart);
  ObjectInputStream objectinputstream = new ObjectInputStream(bytearrayinputstream);
  serializable = (Serializable)objectinputstream.readObject();

The exact same code works perfectly outside of JBoss, and it seems clear that I'm running into a problem with classloaders. The object contained within the ObjectMessage is of a type found in my application. This type is used in many other places in the app (including the sending of the message) and works fine. The MQ Series classes are located in lib/ext, and since JBoss gets the connections/sessions started and I'm able to send and receive messages, they also seem to work fine. It appears that the classloader that is being used to attempt to deserialize the contained object (the CL that loaded MQ classes?) cannot see the classes in the app, thus the ClassNotFoundException. However, the MQ classes have to come from lib/ext (or another server-level context), since they're used by various mbeans during startup.

I'm probably overlooking something here, but this seems to be a catch 22.

This is a build of 2.5 from 7/30.

By the way, everything's cool if I stuff a String into the ObjectMessage
 

Reply via email to