File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Tomcat and the fly likes Session Expires Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » Tomcat
Bookmark "Session Expires" Watch "Session Expires" New topic

Session Expires

Sivaraman Lakshmanan
Ranch Hand

Joined: Aug 02, 2003
Posts: 231
Hi All,
We use Apache as the webserver and tomcat 4.1 servlet engine. In our application we have given the max session timeout to be 1 hour. For some reason during a particular hour of the day when the users logs in they are logged out automatically after 10 to 15 minutes. I could not see any error trace in front end logs. The traffic is also not high during that time.So I am wondering what is causing the user to logout automatically?

I am clueless here. I would appreciate if someone can help me out in this issue.

Vishal Matere
Ranch Hand

Joined: Jan 22, 2008
Posts: 81
As you can see its very difficult to find whats wrong with your deployment.
However I will try to help you debug this issue.
1.write a class that implements HttpSessionListener
2.Override sessionCreated() & sessionDestroyed() method and get accession to HttpSession object
3.Print when this session was created/last accessed etc (additional info abt session)
4.write Entry for this class in web.xml under Listener tag.
5.start application, wait for session time out after 15mins (for incorrect timeouts)
6.Debug which session got terminated and if there is any specific reasons behind it.(i.e. By calling session.invalidate() somewhere else in code etc)

Not sure if this helps but HOPE SO..

SCJP <br />SCWCD <br />SCBCD <br />SCEA-1
Sivaraman Lakshmanan
Ranch Hand

Joined: Aug 02, 2003
Posts: 231
Thanks for the immediate reply. This issue is happening in production but not consistant. This is a clustered environment so I am not sure how to debug this further. I can certainly use the sessionCreated and sessionDestroyed method in Dev env again but not sure how to recreate this issue.
I agree. Here's the link:
subject: Session Expires
It's not a secret anymore!