On Tue, 28 Nov 2000, David Molloy wrote:
| I was very happy when I got this all working but as it happens I still
| need to restart Tomcat after I make changes. You'll find if you use
| sessions to store classes (in my case I store the User class in a
| session variable called theUser) there seems to be a problem with
| reloading. If anyone has anything to add to this I'd be grateful
| but I'd asked it before. Seemingly when you cause a class reload
| the classes reload but the sessions don't invalidate - so when you
| do a req.getSession(true) you'll find that it grabs the old one and
| when you try to grab theUser it will give a ClassCastException.
| As another person commented before - it seems like a feature but
| it's more like a bug.
Thanks! Seems like we have exactly the same problems, I also have this
UserSession object in the session, and get ClassCast all the time.
Isn't this such a needed feature for developing in Tomcat that it should
be included as a option for a webapp? "reloadable=true" and
"on-reload;invalidate-the-session,ditch-all-the-classes,basically-do-a-
complete-restart,but-somewhat-transparently-for-the-developer=true"
It wouldn't be a problem to reinitialize the UserSession if it came back
from the Session as "null". Especially if it was invalidated before it got
shut down, because I could then store the state. And then Tomcat started
to load all classes "on demand" again. Maybe it even had to run through
the "load-on-startup" servlets.. But it would be the new, fresh classes,
not any stale, loaded-with-the-old-classloader stuff.
--
Mvh,
Endre