With regard to version 3.1 of Tomcat, what specifically must be done to enable automatic reloading of servlets?

Avi Kak

Automatic reloading of servlets by a servlet container comes in handy during the development phase when you are frequently modifying and recompiling the servlets. Having to constantly shutdown and restart the servlet container each time you modify a servlet class can become tiring very quickly.

Automatic reloading of servlets in Tomcat 3.1 is predicated upon two entries in two different files in the directory TOMCAT_HOME/conf:

  1. In the file TOMCAT_HOME/conf/server.xml, you must set the reloadable attribute to true in the context element pertaining to your webapp. For example, I have a webapp named form-processing. So I added the following entry to the file TOMCAT_HOME/conf/server.xml:
    <Context path="/form-processing" docBase="webapps/form-processing" 
      debug="0" reloadable="true" > 
  2. The file TOMCAT_HOME/conf/tomcat.properties allows you to specify a classpath that is passed on to the JVM. The servlets that you want automatically reloaded must not be in this classpath. Note that this classpath is in addition to the classpath specified in the startup file tomcat.bat in the directory TOMCAT_HOME/bin. For the simple webapp form-processing that I mentioned above, I do not need to specify any additional classpaths in the TOMCAT_HOME/conf/tomcat.properties file.
For those just getting into Tomcat 3.1, I should add the caveat mentioned in the Tomcat readme file that the automatic reload feature in Tomcat 3.1 is not recommended for production applications. At this time, it is an experimental feature that when enabled creates extra overhead in processing servlet requests.
0 Comments  (click to add your comment)
Comment and Contribute






(Maximum characters: 1200). You have 1200 characters left.



About | Sitemap | Contact
We have made updates to our Privacy Policy to reflect the implementation of the General Data Protection Regulation.