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.

  1. Back up <tomcat installation folder>/conf/web.xml.
  2. Change the value of <session-timeout> (30 by default) to the desired number of minutes.
  3. 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 conf folder.
  • 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

  1. Open <tomcat installation folder>/conf/web.xml with a text editor.
  2. Search for <session-timeout>. The default section looks as follows:
<session-config>
    <session-timeout>30</session-timeout>
</session-config>
  1. Replace 30 with 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

  1. Log in to xDM and leave the session inactive for longer than the previous timeout but shorter than the new one.
  2. 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 event can appear in the logs (logger com.semarchy.platform.accessmgmt.adapters.spring.OsgiHttpContextSynchronizer). It is harmless and is not a sign of malfunction.
  • Tomcat upgrades: web.xml can be overwritten when Tomcat is upgraded or reinstalled. The modification should be documented and re-applied if necessary.