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

Peter,

On 1/24/13 1:01 PM, Peter Lavin wrote:
> ClassLoader contextClassLoader = 
> Thread.currentThread().getContextClassLoader();
> 
> // this line was missing in earlier note //this calls the class
> below FileClassLoader cl = new
> FileClassLoader(contextClassLoader);
> 
> Class<?> spClass = cl.arrayToClass(null, byArray, True);

What if you try this:

ClassLoader contextClassLoader =
Thread.currentThread().getContextClassLoader();

FileClassLoader cl = new FileClassLoader(contextClassLoader);

Class<?> spClass = cl.arrayToClass(null, byArray, True);

Thread.currentThread().setContextClassLoader(cl);

Tomcat changes the context ClassLoader all the time, and you'll want
your ClassLoaders to remember previously-loaded classes, so this isn't
a great solution in general.

That's why I suggested that you use a "loader" configured in
context.xml: that will let you define your own ClassLoader where you
can call arrayToClass at any point and not have to set the context
ClassLoader all the time.

If you've got something working and you're happy, then there's nothing
left to do. If it were me, I'd use a custom Loader for my webapp and
use Java's ObjectInputStream.

- -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/

iEYEAREIAAYFAlEBhhUACgkQ9CaO5/Lv0PCIkwCfc0MmIyzRqKPuFeY0legimEEG
bA0AoLN//xy4svN8r7TsfqYtrVdaV7+t
=FDOH
-----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