Well, Endre, comments such as "classloading is totally fucked", while having
a nice kewl sound-bite quality, really don't explain what is going on too
well to someone who hasn't encountered the problem before.

Speaking for myself, I had not seen any sort of explanation on the mailing
list before (haven't done an extensive archive check, admittedly, esp. on
the developer list), nor in the Jakarta FAQs.  Another poster commented that
this item keeps popping up; perhaps making this into a FAQ item would insure
that questions and comments on the topic would assist in preventing this
question from (re)occuring.  (Perhaps a weekly posting of FAQ items would
help as well, but that's another issue.)

Thanks for the explanation, though.  And your English is just fine. :-)

Regards,
Joel Parramore



> -----Original Message-----
> From: Endre Stolsvik [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, May 02, 2001 2:53 AM
> To: [EMAIL PROTECTED]
> Subject: Re: Objects in Vector are loosing type
>
>
> 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_
> supported.)
>
> 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.
>
> Endre.

Reply via email to