Geode Session State Example using Tomcat

This is a simple example which demonstrates how to setup and use the Session Management Module for Tomcat.

This example assumes you have Geode and Java installed. It also assumes you have local copy of Tomcat Downloaded. It was designed and tested with Geode 1.9.0 and Tomcat 9, and while the session features will work with other combinations you may need to make some changes to the setup if you're using other versions. For more information about how to set up the tomcat module with your version of Tomcat and Geode see the official documentation at:


  1. Set the environment Variable $CATALINA_HOME to point at the root directory of your local Tomcat installation. This is required by Tomcat, so in some cases this may have already been set.

  2. Find the configuration files located at $CATALINA_HOME/conf/. To the server.xml file add the line:

<Listener className="org.apache.geode.modules.session.catalina.ClientServerCacheLifecycleListener"/>

and to the file context.xml add the line:

<Manager className="org.apache.geode.modules.session.catalina.Tomcat9DeltaSessionManager"/> 
  1. Run the setup script:
./ <root directory of Geode install>

Specify the root directory of your local Geode installation. Make sure you have no local Geode cluster running, as this step will start a new local cluster to manage our Session States. This can be done by running gfsh from your geode installation and running a connect command with no parameters. If a cluster is found, use the shutdown command to stop the cluster before continuting.

  1. Run the tomcat startup script located at $CATALINA_HOME/bin/ You should now be able to reach the example webapp by entering the following URL into your browser:
  1. You should now be able to see details about your current session on the page. You can add key/value pairs to your session and get them back with the available input prompts.