Steps to modify tomcat session-timeout

Apache Tomcat J2EE Server

Assumptions:
1. Tomcat is installed as service
2. Tomcat is installed at D:\Softwares folder

In Tomcat the session timeout interval can be changed by updating the property ‘session-timeout‘.
To Change Session timeout in Tomcat follow the steps mentioned below:

1. Goto D:\Softwares\Tomcat\conf folder

2. Open the file ‘web.xml’ in the directory D:\Softwares\Tomcat\conf in wordpad or a proper text editor.
NOTE: In windows 2008 you might need to open the Editor using the “Run as Administrator” option.

3. Search for the text “Session”, you should find a code block similar to the example below:
——————————————————————————————



<!-- ==================== Default Session Configuration ================= -->
<!-- You can set the default session timeout (in minutes) for all newly -->
<!-- created sessions by modifying the value below. -->

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

——————————————————————————————
NOTE: The above block might vary from version to version and if modifications are already made.

4. The following line in the code mentions session timeout is 30 minutes

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

5. Change the following line:

	<session-timeout>30</session-timeout> 
    To:
    <session-timeout>60</session-timeout>

NOTE: 60 means 60 minutes – this can be changed as required based on the requirement.

6. Save the web.xml

7. Restart Tomcat.

NOTES:
1. After changing the session time out Tomcat Restart is required.
2. The variable in view source also shows session timeout as 30 minutes.

In case of any ©Copyright or missing credits issue please check CopyRights page for faster resolutions.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.