Sessions do indeed belong to webapps. This is mandated by the servlet
specification, and Tomcat enforces the restriction. (See the Catalina
configuration documentation on "Single Sign On" for information on how to
configure Tomcat 4.0 so that you only have to sign on once, even though
the sessions for different web apps are still separate.)
Tomcat 4.0 attempts to save and restore sessions across restarts -- either
because of automatic reloading or because of a manual shutdown and
restart. As long as all of your session attributes implement
java.io.Serializable, the attributes will be saved and restorted as well.
NOTE: Various versions of 4.0 (including beta 1) have had problems with
this, which have been fixed in more recent versions. I would suggest
downloading a recent nightly build, or waiting for Tomcat 4.0 Beta 4 which
is scheduled to be released tonight.
Craig McClanahan
On Thu, 10 May 2001, Michael Bergknoff wrote:
> Bo, thanks for the comments. Let's move the discussion
> to the developer list and see if they have some
> comments.
>
> Thanks,
> Mike
>
> >>From: "Bo Xu" <[EMAIL PROTECTED]>
> >>Reply-To: [EMAIL PROTECTED]
> >>To: [EMAIL PROTECTED]
> >>Subject: Re: destroy/init sequence
> >>Date: Sun, 06 May 2001 23:13:58 -0000
> >>
> >>>From: Michael Bergknoff <[EMAIL PROTECTED]>
> >>>Does the container maintain session state across
> >>>a destroy/init sequence? If so is it up to each
> >>>servlet to serialize or delete any objects stored
> >>>in the session? For debugging, is it possible to
> >>>control when the destroy method is called?
> >>>
> >>>Thanks,
> >>>Mike
> >>>[...]
> >>
> >>
> >>Hi :-) I am not sure:
> >>- IMHO, I think HttpSession doesn't has much
> relation
> >> with one special MyServlet, session is "of"
> >> webapps/container(not this webapp or that...),
> i.e.,
> >> session is cross-webapp, so session is loaded by
> >> another classloader which is different from the
> webapp
> >> classloader which loads MyServlet. so even if the
> old
> >> webapp classloader is destroyed/GCed, the session
> object
> >> and its Class object and its classloader are still
> there.
> >>[...]
> >>
> >
> >Hi :-) I find a mistake in my last email:-)
> >
> >with TC4.0b1(standalone, JDK1.3, winnt40):
> >- session is "of" a special webapp, with the same
> browser:
> > % diferent webapp "has" different session
> > % diferent MyServlet in the same webapp "has" same
> session
> >
> >- when I updated MyServlet in webapp0, then MyServlet
> will be
> > reloaded, then the session of webapp0 will be a new
> > one(before it is expired)
> >
> > is the above right? why does the container destroy
> session
> > of a webapp when this webapp's classloader is
> updated?
> >
> >
> >have a nice day! :-)
>
>
>
>
> __________________________________________________
> Do You Yahoo!?
> Yahoo! Auctions - buy the things you want at great prices
> http://auctions.yahoo.com/
>