#14 support for context classloader during deserialization

closed
Tim Anderson
5
2006-06-10
2004-06-29
Johnathan Conley
No

If OpenJMS is used in an Embedded system where the
classloaders are controlled through
Thread.currentThread().setContextClassloader(), it is
not able to properly deserialize object messages in
ObjectMessageImpl because it uses the default
implementation of ObjectInputStream.

Javadocs state that if you want to expand the
classloader capability, you need to extend the
resolveClass method yourself.

You would need to do something like the following:

protected Class resolveClass(ObjectStreamClass desc)
throws IOException, ClassNotFoundException {
ClassLoader cl =
Thread.currentThread().getContextClassLoader();
if (cl!=null)
return cl.loadClass(desc.getName());
return super.resolveClass(desc);
}

Discussion

  • Tim Anderson
    Tim Anderson
    2006-06-10

    Logged In: YES
    user_id=557161

    Support added in CVS. Will be available in 0.7.7-beta-1

     
  • Tim Anderson
    Tim Anderson
    2006-06-10

    • assigned_to: jalateras --> tanderson
    • status: open --> closed