Solved

Tomcat session timeout

Posted on 2008-10-11
1
2,507 Views
Last Modified: 2013-12-02
Hi! We've been having a very random problem. We use Apache Tomcat and have the settings in the web.xml for a 30 minute timeout. For some reason, some of our users (including are staff) very randomly get logged out after just 4-5 minutes of inactivity.

We haven't yet tried the solution of using session.setMaxInactiveInterval in our application (from this link: http://www.experts-exchange.com/Web/Web_Servers/Apache/Q_20878998.html+tomcat+session&hl=en&ct=clnk&cd=14&gl=us) but want to know if anyone might have any other suggestions on why this might be happening?

Any help would be appreciated.

Thanks,
SP
0
Comment
Question by:ieteam
1 Comment
 
LVL 27

Accepted Solution

by:
rrz earned 500 total points
ID: 22695986
>any other suggestions on why this might be happening?  
I don't know. But I did some testing with the following code.  I tried 10 sessions with 5  and they all timed out after 5 minutes exactly.
package rrz;   

import java.io.*;

import java.util.*;

import javax.servlet.*;

import javax.servlet.http.*;

public class SessionLengthListener implements HttpSessionListener {

  public void sessionCreated(HttpSessionEvent event) {}

  public void sessionDestroyed(HttpSessionEvent event) {

                      HttpSession session = event.getSession();

                      String id = session.getId();

                      long sessionLength = (new Date().getTime() - session.getLastAccessedTime())/60000;

                      System.out.println(id + " was timed out after " + sessionLength + " minutes"); 
 

  }

}

Open in new window

0

Featured Post

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

Upgrading Tomcat – There are a couple of methods to upgrade Tomcat is to use The Apache Installer is to download and unzip and run the services.bat remove|install Tomcat6 Because of the App that we are working with, we can only use Tomcat 6.…
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
Viewers learn about the scanner class in this video and are introduced to receiving user input for their programs. Additionally, objects, conditional statements, and loops are used to help reinforce the concepts. Introduce Scanner class: Importing…
This tutorial will introduce the viewer to VisualVM for the Java platform application. This video explains an example program and covers the Overview, Monitor, and Heap Dump tabs.

744 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now