User Guide

To make use of this library you must run at least Java context.get("").

These components have been tested with Apache Tomcat 8.5.x only.

This site will guide you through the components of this library:

  1. CloseableResourceListener: Prevents memory leaks caused by left open resources during undeployment. (discontinued)
  2. LogbackContextNameListener: Makes Logback aware of a webapp's context name. (superseded)
  3. ContextNamingInfoListener: Provides you all necessary context naming information via JNDI environment entries.
  4. EnhancedErrorReportValve: An alternative error report valve with several improvements over the original one. (discontinued)
  5. PropertiesRoleMappingListener: Provides a mapping from technical roles to application roles from a properties file.

Before using this library, make sure that the artifact is in the class path of your Tomcat instance, i.e., in $CATALINA_BASE/lib or $CATALINA_HOME/lib.


This listener is obsolete now since Tomcat includes a close handler from version 7. See here for details on closeMehod.


This listener has been superseded by the ContextNamingInfoListener.


Ever needed your context path, name, version, etc. to be available to your application or your Spring context?

Open your app's context.xml and add:

  <!-- Add this -->
  <Listener className="net.sf.michaelo.tomcat.extras.listeners.ContextNamingInfoListener" />

It will automagically add your context naming information as environment entries to your webapp's JNDI initial context. For more details see the here.


This valve is obsolete now since Tomcat does include all modifications in the bundled valve. See Bugzilla issue for details.


Consider you cannot change the role names from your company's role store but would like to use readable role names in your app. This can be achieved with a proper mapping performed by this listener. For more details see the here.

To make use of this listener you must declare it in your application. Open your app's context.xml and add:

  <!-- Add this -->
  <Listener className="net.sf.michaelo.tomcat.extras.listeners.PropertiesRoleMappingListener" />
  <!-- Followed by your realm -->
  <!-- <Realm … /> -->

now add the appropriate role mapping file to WEB-INF/

id-xyz = User
id-abc = Manager
id-foo = Admin

Make sure that your realm implementation actually queries the populated mapping and then you can user the new application roles in your web.xml and with request#isUserInRole().