Using Tomcat Reload Features To Speed Up Development

February 4, 2016 by Linux Guru

Filed under Linux, logs

Last modified July 15, 2016

Using Tomcat Reload Features To Speed Up Development

Hot Reload Via Context Settings

In detail-oriented stages of development, such as optimization, it is often necessary to make many small changes, some of which are merely tests of a variety of methods by which a single feature could be coded.  In this kind of environment, manually triggering every reload via the Manager application is not feasible or efficient enough.

To address this issue, Tomcat includes a method called “backgroundProcess” as part of the Catalina component.  Normally, this process provides sessions expiration, but when properly configured, it can also monitor all of an application’s classes for changes, and call for a reload if any of them change.

To configure reloading, add the “reloadable” attribute to your application’s Context element, either in its Context fragment or in Server.xml:

<Context … reloadable=”true”>

You can also configure the delay in seconds before the backgroundProcess is run on the container in the context element, via the backgroundProcessorDelay attribute, although this value can also be inherited from the Host or Engine.

Hot Reload with WatchedResource

When you define a Context as “reloadable”, Catalina’s default behavior is to watch its classes, libraries, and web.xml configuration files for changes to trigger reload.  Sometimes you’ll want to add other files to this list, such as logger configuration files.  In these situations, you can use the WatchedResource element nested inside the Context to specify additional files that Tomcat should watch.  Use the following syntax:


<Context … reloadable=”true”>





Note that only one file may be contained in each pair of WatchedResource tags.  You can configure these settings either in the application’s context.xml fragment, the server.xml file, or in Catalina’s conf/context.xml file, if you would like to create global settings for all contexts.

Ref url:-

for monitoring above changes open catalina.out

Leave a Comment