-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Pid,
On 10/10/2011 2:23 PM, Pid wrote:
> On 10/10/2011 18:51, Peter Lavin wrote:
>> Hi Filippo, tks for your reply.
>>
>> I'm not actually specifying any ClassLoader, perhaps I should?
>> How should I specify a ClassLoader to use when dynamically
>> loading a class?
>
> You can pass one into the Constructor of your own classloader:
>
> public CustomClassloader(ClassLoader parent) { super(parent); }
And to be perfectly explicit, OP should be doing this when
constructing their CustomClassLoader (presumably in a
ServletContextListener):
CustomClassLoader cl = new
CustomClassLoader(Thread.currentThread().getContextClassLoader());
This should allow Peter's ClassLoader to find superclass definitions
from the webapp's ClassLoader.
I have a question, though, since the default parent ClassLoader of any
ClassLoader /should/ be the current thread's context ClassLoader, so
none of the above code should be necessary.
Perhaps the CustomClassLoader is being initialized in a weird way that
does not make the above connection.
- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
iEYEARECAAYFAk6TWHwACgkQ9CaO5/Lv0PD//gCgthcJU6rJ5pVjkJt3AOgEHqGq
EeYAnjq+VkKl/Ojx0QbP2lXPh5062bR6
=3mOs
-----END PGP SIGNATURE-----
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]