Solved

Tomcat session timeout

Posted on 2008-10-11
1
2,517 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Are you developing a Java application and want to create Excel Spreadsheets? You have come to the right place, this article will describe how you can create Excel Spreadsheets from a Java Application. For the purposes of this article, I will be u…
In this post we will learn how to make Android Gesture Tutorial and give different functionality whenever a user Touch or Scroll android screen.
Viewers will learn about basic arrays, how to declare them, and how to use them. Introduction and definition: Declare an array and cover the syntax of declaring them: Initialize every index in the created array: Example/Features of a basic arr…
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.

728 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