2

The manual below says:

Apache Tomcat 9 Configuration Reference - The Manager Component

Introduction

A Manager element MAY be nested inside a Context component. If it is not included, a default Manager configuration will be created automatically

My Context has no nested Manager element:

<Context>
    <WatchedResource>WEB-INF/web.xml</WatchedResource>
    <WatchedResource>WEB-INF/tomcat-web.xml</WatchedResource>
    <WatchedResource>${catalina.base}/conf/web.xml</WatchedResource>

    <!-- Uncomment this to disable session persistence across Tomcat restarts -->
    <!--
    <Manager pathname="" />
    -->
</Context>

So, the default is to be used:

The Manager Component - Standard Manager Implementation

pathname: Absolute or relative (to the work directory for this Context) pathname of the file in which session state will be preserved across application restarts, if possible. The default is "SESSIONS.ser".

The question is, where can I find this SESSIONS.ser file?

1 Answer 1

3

If you don't configure a session manager explicitly, one is provided for you. If the attribute pathname is a relative location, it is resolved against the application's working directory, which is by default:

$CATALINA_BASE/work/[enginename]/[hostname]/[appname]

(usually $CATALINA_BASE/work/Catalina/localhost/[appname]).

Following symbolic links on Ubuntu it is situated in:

/var/cache/tomcat9/[enginename]/[hostname]/[appname]

You can change the location of the working directory setting the workDir parameter of <Host> (c.f. documentation).

2
  • I couldn't find any sessions there. Is it possible they are only in memory?
    – Gustavo
    Jun 20, 2021 at 12:24
  • While the application is running they are kept in memory. To write them to disk stop the application (e.g. stop the server). Jun 20, 2021 at 13:07

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .