Apache Geode CHANGELOG

Setting Up the HTTP Module for Tomcat

To use the Geode HTTP module with Tomcat application servers, you will need to modify Tomcat’s server.xml and context.xml files.

Configuration is slightly different depending on the topology you are setting up: peer-to-peer or client/server. Refer to Common Topologies for HTTP Session Management for more information.

Peer-to-Peer Setup

To run Geode in a peer-to-peer configuration, add the following line to Tomcat’s $CATALINA_HOME$/conf/server.xml within the <Server> tag:

<Listener className="org.apache.geode.modules.session.catalina.PeerToPeerCacheLifecycleListener"
        locators="localhost[10334]" />

Depending on the version of Tomcat you are using, add one of the following lines to $CATALINA_HOME$/conf/context.xml within the <Context> tag:

For Tomcat 7.0:

<Manager className="org.apache.geode.modules.session.Tomcat7DeltaSessionManager"/> 

For Tomcat 8.0 and 8.5:

<Manager className="org.apache.geode.modules.session.catalina.Tomcat8DeltaSessionManager"/> 

For Tomcat 9.0:

<Manager className="org.apache.geode.modules.session.catalina.Tomcat9DeltaSessionManager"/> 

Client/Server Setup

To run Geode in a client/server configuration, the application server will operate as a Geode client. To do this, add the following line to $CATALINA_HOME$/conf/server.xml within the <Server> tag:

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

Depending on the version of Tomcat you are using, add one of the following lines to $CATALINA_HOME$/conf/context.xml within the <Context> tag:

For Tomcat 7.0:

<Manager className="org.apache.geode.modules.session.catalina.Tomcat7DeltaSessionManager"/> 

For Tomcat 8.0 and 8.5:

<Manager className="org.apache.geode.modules.session.catalina.Tomcat8DeltaSessionManager"/> 

For Tomcat 9.0:

<Manager className="org.apache.geode.modules.session.catalina.Tomcat9DeltaSessionManager"/> 

The application server operates as a Geode client in this configuration.

Set the CLASSPATH environment variable. For a client/server set up using Apache Tomcat v9 and Geode v1.13, the CLASSPATH setting should be similar to the following. Adjust filenames and version numbers as needed for your implementation.

CLASSPATH="$CATALINA_HOME/lib/geode-modules-1.13.3.jar:\
$CATALINA_HOME/lib/geode-modules-tomcat9-1.13.3.jar:\
$CATALINA_HOME/lib/servlet-api.jar:\
$CATALINA_HOME/lib/catalina.jar:\
$CATALINA_HOME/lib/tomcat-util.jar:\
$CATALINA_HOME/bin/tomcat-juli.jar"

Start the locator and server using gfsh:

$ gfsh start locator --name=locator1 --classpath=$CLASSPATH
$ gfsh start server --name=server1 --locators=localhost[10334] --server-port=0 \
  --classpath=$CLASSPATH

Starting the Application Server

Once you’ve updated the configuration, you are now ready to start your tc Server or Tomcat instance. Refer to your application server documentation for starting the application server. Once started, Geode will automatically launch within the application server process.

Note: Geode session state management provides its own clustering functionality. If you are using Geode, you should NOT turn on Tomcat clustering as well.

Verifying that Geode Started

You can verify that Geode has successfully started by inspecting the Tomcat log file. For example:

15-Jul-2021 10:25:11.483 INFO [main] org.apache.catalina.startup.HostConfig.deployDirectory Deployment of web application directory [/Users/user/workspace/apache-tomcat-9.0.62/webapps/host-manager] has finished in [1,688] ms
15-Jul-2021 10:25:11.486 INFO [main] org.apache.coyote.AbstractProtocol.start Starting ProtocolHandler ["http-nio-8080"]
15-Jul-2021 10:25:11.493 INFO [main] org.apache.catalina.startup.Catalina.start Server startup in [11682] milliseconds