We have an app where we are using an embedded felix instance to deploy
plugin functionality.  Our bundles contain implementations of a
publically knnown interface, and also contain a properties file with the
class names to load.  When the bundle is loaded, we look at the
properties file, load the Class from the classfile, and pass around the
reference to that Class (just the Class, not an instance of it) in our
application.

 

We're seeing a StreamCorruptedException in our application, and after
some serious debugging cannot figure out where it's coming from.  My
theory is that we accidentally serialized the object holding on to the
osgi-loaded class into a disk-based cache, and the exception is
occurring because the ObjectInputStream can't load that class with the
web container's classloader when it tries to deserialize it.

 

Question: Does it make sense that ObjectInputStream would have trouble
deserializing an instance of java.lang.Class?  I'm not sure if
deserializing the Class object actually requires that the class be
loaded from a classloader or not.  If it did require classloading, then
I could understand the exception, since the servlet container's
classloader wouldn't know about the class.

 

Thanks in advance for any help...

 

Reply via email to