You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Dzmitry Ilyin <il...@keos.de> on 2006/09/21 16:44:28 UTC

HttpSession loose attributes.

Hello Everybody,

Could anybody help to solve the problem.
I have apache Tomcat 5.5 .
My web application stores  some attributes  in HttpSession object, for ex. 
User object , etc.
When i updating some java classes (.class) in application (just copy it to 
WEB-INF / etc....) or
resources (for ex .properties) session object loose all stored  attributes , 
maybe because session re-opened.
When i do the same with jsp or html files everything is OK.
Where is my mistake? How to make this "fast deployment"  without loosing 
session.

Thanks a lot
Dzmitry 


---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: HttpSession loose attributes.

Posted by Christopher Schultz <ch...@christopherschultz.net>.
Dzmitry,

> When i do the same with jsp or html files everything is OK.
> Where is my mistake? How to make this "fast deployment"  without loosing
> session.

If the objects you put into the session do not implement Serializable,
then your session will fail to re-load along with the webapp.

When you copy a new JSP into your webapp, only that JSP will re-load.
However, when you update a .class file, Tomcat re-starts the entire
webapp for you (if you have it configured to do that). Part of the
re-start procedure is to write all sessions to a file before the webapp
is taken out of service, and then to read them back from that file when
the new instance starts up.

If your session attributes are not Serializable, the sessions cannot of
saved or re-loaded, so you get a new session every time you re-start.

-chris