File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
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
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: 12835
    
    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: 12835
    
    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
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Stale session after tomcat restart