-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Peter,
On 4/2/12 2:05 PM, Peter Lavin wrote:
> this may be a general Java question or their may be a specific
> answer related to Tomcat.
This is unrelated to Tomcat, since you are using java.net.URLClassLoader.
> I am running a simple webservice which loads classes using a
> URLClassloader...
>
> // start of code snippet ClassLoader previous =
> Thread.currentThread() .getContextClassLoader(); URLClassLoader
> loader = new URLClassLoader(new URL[] { new
> URL("http://localhost/classes/")}, previous);
>
>
> String className = "common.MyClassToBeLoaded"; Class<?> ho =
> loader.loadClass(className); // end
>
> This ok, but when I edit and recompile a class which is loaded,
> the changes to MyClassToBeLoaded.java are not reflected in the
> webservice.
That's the way most ClassLoaders work: they are designed to cache
classes so that performance doesn't totally suck. Imagine if the JVM
kept having to check to see if java.lang.Object had been updated...
> Is there a way to empty this cache, or disable caching all
> together?
Not without implementing your own ClassLoader. You could read the code
for WebappClassLoader to see how it's done in there.
> There are some suggestions out there but none specific to Tomcat.
That's because this can be done without regard to Tomcat's operation.
- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG/MacGPG2 v2.0.17 (Darwin)
Comment: GPGTools - http://gpgtools.org
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
iEYEARECAAYFAk96DrEACgkQ9CaO5/Lv0PBqMQCeLuGqS/3EF3475s7mavDRK/BQ
D9oAnAyjAtQYj89s6TM+iDPSIbVk0euN
=+2b2
-----END PGP SIGNATURE-----
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]