Skip to content

Latest commit

 

History

History
80 lines (58 loc) · 3.12 KB

README.adoc

File metadata and controls

80 lines (58 loc) · 3.12 KB
appng logo 760px

::mongo-version: 3.5.0

appNG Tomcat Session

This library contains implementations of Apache Tomcats org.apache.catalina.Manager using Redis and MongoDB.

Prerequisites

By default, Tomcats uses it’s own logging component named JULI, writing logfiles to CATALINA_HOME/logs.

However, if you want to see some logging in the appNG.log of your appNG installation, move the following files from APPNG_HOME/WEB-INF/lib into the CATALINA_HOME/lib directory:

  • log4j-1.2.17.jar

  • slf4j-api-1.7.25.jar

  • slf4j-log4j12-1.7.25.jar

Next, set the category for org.appng.tomcat.session in APPNG_HOME/WEB-INF/conf/log4j.properties to the required level:

log4j.category.org.appng.tomcat.session = trace

Using Redis

The implementation is based on the great work of James Coleman’s tomcat-redis-session-manager.

A few changes were made to support Tomacat 8 and the latest version of Redis.

Configuration

Add the following into your Tomcat context.xml (or the context block of the server.xml if applicable.)

<Valve className="org.appng.tomcat.session.redis.RedisSessionHandlerValve" />
<Manager className="org.appng.tomcat.session.redis.RedisSessionManager"
    host="localhost"
    port="6379"
    database="0"
    maxInactiveInterval="60"
    sessionPersistPolicies="ALWAYS_SAVE_AFTER_REQUEST" />

Copy the following files into the TOMCAT_BASE/lib directory:

Reboot the server, and sessions should now be stored in Redis.

Using MongoDB

The implementation is based on the great work of Kevin Davis' mongo-session-manager.

A few changes were made to support Tomacat 8 and the latest version of MongoDB.

Configuration

Add the following into your Tomcat context.xml (or the context block of the server.xml if applicable.)

<Valve className="org.appng.tomcat.session.mongo.MongoSessionTrackerValve" />
<Manager className="org.appng.tomcat.session.mongo.MongoPersistentManager" maxIdleBackup="30">
	<Store className="org.appng.tomcat.session.mongo.MongoStore"
		hosts="localhost:27017"
		dbName="tomcat_sessions"
		maxPoolSize="25"
	/>
</Manager>

Copy the following files into the TOMCAT_BASE/lib directory:

Reboot the server, and sessions should now be stored in MongoDB.

License

appNG is licensed under the Apache License 2.0.