Servlet Auto-Reloading

Tomcat by default will automatically reload a servlet when it notices that the servlet's class file has been modified. This is certainly a great convenience when debugging servlets; however, bear in mind that in order to implement this functionality, Tomcat must periodically check the modification time on every servlet. This entails a lot of filesystem activity that is unnecessary when the servlets have been debugged and are not changing.

To turn this feature off, you need only set the reloadable attribute in the web application's Context element (in either your server.xml or your context XML fragment file, wherever you've stored your Context element), and restart Tomcat. Once you've done this, you can still reload the servlet classes in a given Context by using the Manager application (detailed in the section "The Manager Webapp" in Chapter 3).

Get Tomcat: The Definitive Guide, 2nd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.