• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1337
  • Last Modified:

Session Timeout issue

I want to set my session timeout to 8 hours.  I am using SunOne webserver.

In my JSP, I have  session.setMaxInactiveInterval(60*60*8);
But my session seems to get timed out in less than 30 minutes.

I tried to print session.getMaxInactiveInterval and it does print 28800(60*60*8) but for some reason session gets invalidated in about 30 minutes. any thoughts?

Thanks.
0
mytilig
Asked:
mytilig
  • 2
  • 2
1 Solution
 
bloodredsunCommented:
You should really be setting your session timeouts in the web.xml

Why do you need a 8 hour session? Remember that a session expires a set time after the last recorded request from that user, not from the start of that session.
0
 
gksinghietCommented:
Yes bloodredsun is right you can set the sessin timeout time in web.xml as:

<session-config>
  <session-timeout>480</session-timeout>
</session-config>
Here the value of session-timeout tag is timeout for a session in minutes.
0
 
mytiligAuthor Commented:
I have removed the session.setMaxInactiveInterval(60*60*8);  from my code and added this to my web.xml
<session-config>
            <session-timeout>720 </session-timeout>    
    </session-config>

(I want the session to time out after 12 hours.)

The application still seems to be getting timed out after the 1st hour before the 2nd hour. I print session.getMaxInactiveInterval() in my main JSP page, and it prints 43200 (720*60), so I am inclined to believe it is reading web.xml correctly.
Wondering why it still times out quickly?
Thanks.
0
 
gksinghietCommented:
How are you measuring session timeout interval?
Seems there might be bug in few of the web servers.
Refer:
http://www.jguru.com/faq/view.jsp?EID=525564
0
 
mytiligAuthor Commented:
I have sunone 6.1 webserver. The doc says timeout should be given in minutes within web.xml
When I specify it as 720 and execute my code to print sessiontimeout, it prints 43200 (720*60)
Thank you.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now