Win a copy of 97 Things Every Java Programmer Should Know this week in the Java in General forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Jeanne Boyarsky
  • Junilu Lacar
  • Henry Wong
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Frits Walraven
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • salvin francis
  • fred rosenberger

Stale session after tomcat restart

 
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Author and all-around good cowpoke
Posts: 13078
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 21
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks William.
Is there any way to tell tomcat not to do so?
 
William Brogden
Author and all-around good cowpoke
Posts: 13078
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
He repaced his skull with glass. So you can see his brain. Kinda like this tiny ad:
Devious Experiments for a Truly Passive Greenhouse!
https://www.kickstarter.com/projects/paulwheaton/greenhouse-1
    Bookmark Topic Watch Topic
  • New Topic