• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Stale session after tomcat restart

 
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
I don't like that guy. The tiny ad agrees with me.
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic