This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Tomcat and the fly likes Stale session after tomcat restart Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Products » Tomcat
Bookmark "Stale session after tomcat restart" Watch "Stale session after tomcat restart" New topic
Author

Stale session after tomcat restart

Ankur Sharma
Greenhorn

Joined: Nov 30, 2007
Posts: 21
Hi,

I see this weird behavior in my application.
Scenario:
App runs in Tomcat (Env: Java, Struts, iBATIS, Eclipse ) in my machine locally
I login to application. browse few pages.
I restart the Tomcat.

now if I continue browsing my application it just works fine. it does not ask me to login again. It happens sporadically.

Has any body else came across this issue?

Please let me know if you know why it happens and how to resolve this issue.

Thanks.
William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12756
    
    5
It happens because Tomcat is allowed to serialize sessions out to the hard disk and pick them back up on restart. This is considered desirable behavior if you want to prevent it you will have to do some programming.

Bill
Ankur Sharma
Greenhorn

Joined: Nov 30, 2007
Posts: 21
Thanks William.
Is there any way to tell tomcat not to do so?
William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12756
    
    5
It looks like "persistent" sessions are on by default and can be configured in the context.xml configuration file. I suspect that this configuration depends on which version of tomcat you have. In my Tomcat 5.5.20 default context.xml file I find the following;


I have not played with it - let us know what happens

Bill
 
Don't get me started about those stupid light bulbs.
 
subject: Stale session after tomcat restart
 
Similar Threads
Tomcat 6.0.32 HTTP Status 403 - Access to the requested resource has been denied
problem in database connection
Secure Log In Question
"Timer-10" java.lang.OutOfMemoryError: Java heap space
Internationalization in Struts and Tomcat5