How to change session expiration (timeout) in Tomcat

Home > Search > How-to
  by

You may want to first read about the difference between a session and a cookie.

The session timeout is set in the JVMs web.xml file. Typically, the default setting is 30 (minutes). If you change the session timeout value, you will have to restart the JVM for the change to take effect.

<session-config>
  <session-timeout>30</session-timeout>
</session-config>

 

For demonstration purposes, the screen shot below shows a Java app displaying the session ID number.

 

Then, after 30 minutes, the app has a new session ID number, since the prior session timed out after 30 minutes.



Add a Comment




We will never share your name or email with anyone. Enter your email if you would like to be notified when we respond to your comment.




Please enter in the box below so that we can be sure you are a human.




Comments