Blogs
Overview
The Liferay Portal user session timeout is defined by the session timeout value.
The article outlines potential solutions for configuring the user session timeout (see Solutions below).
Background
The session timeout is loaded by method "checkWebSettings" in Liferay Portal Java class com.liferay.portal.servlet.MainServlet.
The session timeout property value is loaded in the following order:
1/ Property “session.timeout” in property file “portal.properties”
NOTE: The default path for the “portal.properties” file in a Liferay Portal + Apache Tomcat bundle is “LIFERAY_HOME/tomcat/webapps/ROOT/WEB-INF/portal-impl.jar”.
2/ Property “session.timeout” in property file "LIFERAY_HOME/portal-ext.properties”
NOTE: The default path for the “portal-ext.properties” file in a Liferay Portal + Apache Tomcat bundle is “LIFERAY_HOME”.
{code}
#
# Specify the number of minutes before a session expires.
# This value is always overridden by the value set in web.xml.
#
session.timeout=30
{code}
NOTE: The “session.timeout” property is always overridden by the value set in web.xml.
3/ Web config element “session-timeout” in file “web.xml”
NOTE: The default path for the “web.xml” file in a Liferay Portal + Apache Tomcat bundle is “LIFERAY_HOME/tomcat/webapps/ROOT/WEB-INF/web.xml”.
<session-config> <session-timeout>30</session-timeout> </session-config>
NOTE: The session timeout is loaded by the MainServlet. Refer to Java class “com.liferay.portal.servlet.MainServlet#checkWebSettings”
Configuration Options
Following are potential configuration options for configuring the user session timeout.
Option 1 - Over-ride web.xml in deployed Liferay Portal web app
Update session timeout value in <session-timeout> element.
e.g. 8 hours = 480 minutes
FILE: LIFERAY_HOME/tomcat/webapps/WEB-INF/web.xml
<session-config> <session-timeout>480</session-timeout> </session-config>
NOTE: This approach is not recommended as the web.xml file can be over-ridden when applying Liferay Portal patches using the Liferay Portal patching tool.
Option 2 - Over-ride session timeout value in web.xml using portal EXT plugin
NOTE: This approach may not work due to the Liferay Portal patching process (TBC).
Update session timeout value in <session-timeout> element
e.g. 8 hours = 480 minutes
FILE: EXT_PLUGIN/.../WEB-INF/web.xml
<session-config> <session-timeout>480</session-timeout> </session-config>
Option 3 - Remove session timeout value in web.xml using portal EXT plugin
NOTE: This approach may not work due to the Liferay Portal patching process (TBC).
Remove session timeout value and <session-timeout> element from parent <session-config> element
<session-config> </session-config>
NOTE: This approach will ensure the value defined in portal-ext.properties is retained.
References
Related LPS Tickets
- LPS-31820 - Make session.timeout property configurable per Portal Instance
- LPS-39461 - As a developer, I would like the session timeout properties to not be overridden by the web.xml file
- LPS-27350 - Remove the session timeout from web.xml
Related Articles
- Liferay Wiki - Session Timeout
- Stack Overflow - Setting sessiontimeout in Liferay 6.1
- Liferay Hacks - Increasing session timeout in Liferay 6.1.1-CE-GA2
- Liferay Forums - Liferay session timeout change

