-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

Peter,

On 1/22/13 2:16 PM, Peter Lavin wrote:
> I've spent some time on this today and have found (at least I think
> so) that my problem in deserializing an instance of an object is
> related to the ClassLoader that the class ObjectInputStream uses.
> It appears that it does not use the WebappClassLoader of the
> service in question, but instead defaults to a ClassLoader higher
> up the tree (which does not have visibility on the cache of the
> WebappClassLoader).

ObjectInputStream should be using the "context class loader" of the
thread which should be the WebappClassLoader.

Can you show us your code (the part that actually loads the bytes into
the ClassLoader to define the class)?

Also, where does the de-serialization occur? I suspect in the webapp,
but you haven't described everything in detail (and the details count).

> In my service, I've loaded a full class definition and created an 
> instance of it. At this point it (afaik) must be in the cache of
> the WebappClassLoader. However, when an ObjectInputStream is called
> to... ois.readObject() on a byte[] of an instance of that same
> class, it fail for ClassNotFoundException.

Hmm. Can you post the full stack trace of that CNFE?

> A Tomcat solution is identified here... 
> http://tomcat.apache.org/tomcat-7.0-doc/api/org/apache/catalina/util/CustomObjectInputStream.html

I'm
> 
surprised that class needs to exist... I would have expected OIS
to use the context class loader. I'll have to check on that.

> Which is in $CATILANA_HOME/lib/catalina.jar.
> 
> Has anyone use this? do I need to add this jar implement this, and 
> include it in my war file?

You should be able to use that class directly from within
CATALINA_HOME/lib

- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG/MacGPG2 v2.0.17 (Darwin)
Comment: GPGTools - http://gpgtools.org
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iEYEAREIAAYFAlEAPHcACgkQ9CaO5/Lv0PBzPgCbBrCdn8wrD/6YYPoYNpoht6s8
8vsAnifcwJCpAtLsZqc3SfncDY9QdF2k
=wIKl
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org

Reply via email to