tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Endre StĂžlsvik <>
Subject Re: Objects in Vector are loosing type
Date Wed, 02 May 2001 06:52:53 GMT
On Mon, 30 Apr 2001, Joel Parramore wrote:

| Can or has or will someone work up a slightly more technical explanation
| than
| > It's because tomcat's reloading are totally fucked.

Well, Joel, it's because tomcat3x doesn't do this:

a) stop the webapp
b) destroys all servlets
c) serializes all the Sessions
d) throws away the ClassLoader for this webapp
e) cleans away the webapp from all "caches" in the system
f) restarts the whole webapp, as if for the first time, making a new
    ClassLoader for it.
g) deserializes all the Sessions (now with the new ClassLoader)
h) lets the users use the system again

(Which is apparently how tomcat 4 should do it, but it never did for me.
But I am doing a very weird ting according to the developers, I am running
tomcat away from it's installation directory, and this is _not_

What tomcat3x does, is to just ditches the ClassLoader and reloads the
_first_ servlet you hit after a refresh of the .class-files timestamps.
Even if you recompile your whole webapp, tomcat just reloads the first
servlet a user hits. This means that all the other Servlets are still
"cached" using the old ClassLoader, and you actually get two instanses of
your webapp, all the old Session objects and all the other Servlets loaded
with the old ClassLoader, while all the new Session objects and the one,
first hit Servlet with the new ClassLoader.
  It doesn't, as mentioned, do anything about the Session variables, and
therefore you often get ClassCastExceptions when you try to handle and
cast objects gotten from the Session within the one, new reloaded servlet.
This because _it's_ version of the Class you try to cast the object gotten
from the Session to, is loaded with the new ClassLoader, while the object
you try to cast is loaded with the old. This is not considered the same
Classes, and you get ClassCastException.

This is so very, very wrong, and therefore I'd say it's "totally fucked"..
This has been pointed out a whole bunch of times.

Better? I'm not that fantastic with English, hope you excuse that, Joel.


View raw message