-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA256 Mark,
On 1/21/13 3:35 PM, Mark Thomas wrote: > On 21/01/2013 20:30, Konstantin Kolinko wrote: >> 2013/1/21 Peter Lavin <lav...@cs.tcd.ie>: >>> >>> Dear List, >>> >>> My web application needs to deserialize both classes and >>> objects which are sent to it. >>> >>> I'm using Base64 serialization, and when I transport full >>> <name>.class file to a service, I can deserialize it with no >>> problem using ObjectInputStream.readObject(). I also need to >>> transport instances of certain classes to the application but >>> without having the benefit of having the class loaded in the >>> WebappClassLoader. Not surprisingly, deserializing an instance >>> of a class fails for ClassNotFoundException. >>> >>> My question: When I need to transport an instance of a class, I >>> can easily also transport the full class. This full class can >>> be instantiated if required. How could I load this class to the >>> WebappClassLoader and have it available there for when I need >>> to call ois.readObject()? I want to load the (full) class to >>> the WebClassLoader to over come the ClassNotFoundException. >>> >> >> The same as with any other ClassLoader: use the bytes and call >> ClassLoader.defineClass(..), then ClassLoader.resolveClass(..). > > No can do. > > That method is not public. OP could subclass WebappClassLoader and give access to it, then set that as the loader for the webapp, right? - -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/ iEYEAREIAAYFAlD+pwQACgkQ9CaO5/Lv0PDFvgCgll4QihNGLfT3AWQRxxTj45e0 k7MAn0z0bFMBOpqYrMvmnNKv5R4qIVos =GBGX -----END PGP SIGNATURE----- --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org