Need
When Semarchy xDM is deployed on Apache Tomcat, users are logged out automatically after 30 minutes of inactivity. This is the default session timeout of the application server, not a Semarchy-specific setting.
The need is to increase or decrease this duration, for example to avoid frequent re-authentication during long data steward sessions, or to comply with a security policy requiring a shorter session.
Summarized Solution
The session timeout is defined in the web.xml file located in the conf folder of the Tomcat installation, in the <session-timeout> element of the <session-config> section. The value is expressed in minutes.
- Back up
<tomcat installation folder>/conf/web.xml. - Change the value of
<session-timeout>(30 by default) to the desired number of minutes. - Save the file and restart the Tomcat service. The new value is not taken into account until Tomcat is restarted.
Detailed Solution
Prerequisites
- Access to the file system of the server hosting Tomcat, with permission to edit files in the
conffolder. - Ability to restart the Tomcat service. Restarting interrupts the application, so a maintenance window is recommended. All users connected to xDM are disconnected at restart.
- In a high-availability setup (several Tomcat nodes), the change must be applied on every node, with the same value everywhere.
Step 1: Back up the web.xml file
Locate the Tomcat installation folder (<tomcat installation folder>, also called CATALINA_HOME) and copy conf/web.xml to a safe location.
Step 2: Edit the session timeout
- Open
<tomcat installation folder>/conf/web.xmlwith a text editor. - Search for
<session-timeout>. The default section looks as follows:
<session-config>
<session-timeout>30</session-timeout>
</session-config>- Replace
30with the desired duration, in minutes. For example, to log users out after 2 hours of inactivity:
<session-config>
<session-timeout>120</session-timeout>
</session-config>Step 3: Save the file and restart Tomcat
Save web.xml, then restart the Tomcat service (for example via the service manager of the operating system, or with the shutdown and startup scripts of the bin folder). The new value only applies after the restart: a modification that appears to have no effect is most often due to Tomcat not having been restarted.
Step 4: Check the result
- Log in to xDM and leave the session inactive for longer than the previous timeout but shorter than the new one.
- Verify that the session is still active, and that it ends once the new duration has elapsed.
Good to know
- Scope: the setting is defined at Tomcat level and applies to every web application deployed in that Tomcat instance, not only to xDM.
- Inactivity: the timeout counts the time without any request from the user, not the total duration of the session.
- Other components on the path: a load balancer, reverse proxy or cloud service can have its own timeout and end the connection earlier than Tomcat. When users are logged out sooner than the configured value, these settings should be checked too.
- Intermittent disconnections during active use: in a multi-node deployment, they usually point to session affinity (sticky sessions) not being correctly configured on the load balancer or proxy, rather than to the timeout value.
- Log message: after a session ends because of inactivity, a WARN message of the form
Session id ... is not known it may be because the attribute removed event is processed after the session destroyed eventcan appear in the logs (loggercom.semarchy.platform.accessmgmt.adapters.spring.OsgiHttpContextSynchronizer). It is harmless and is not a sign of malfunction. - Tomcat upgrades:
web.xmlcan be overwritten when Tomcat is upgraded or reinstalled. The modification should be documented and re-applied if necessary.