Article updated on

Set Tomcat session Timeout

To change the tomcat session timeout you need to specify or change the session-timeout parameter it in the web.xml whose path is WEB-INF/web.xml. Most web containers/application server tend to respect this rule too.

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

* The timeout parameter is specified in minutes.

Full web.xml in UTF-8

<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
    xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
    id="WebApp_ID" version="2.5">
    <display-name>JCGONZALEZ-BLOG</display-name>
    <session-config>
        <session-timeout>30</session-timeout>
    </session-config>    
    <welcome-file-list>
        <welcome-file>home</welcome-file>
    </welcome-file-list>
</web-app>  

 

* You must restart tomcat to make this change take effect.