Thursday, February 5, 2015

auto reload in Tomcat

While developing JSP pages ( a bit old technology), the developer has not to concern about its compilation and reloading as it is handled by Apache Tomcat server itself. However, when you are working with servlets, it is the programmer who has to compile and provide the classes in correct directory structure to the tomcat. Moreover, once the servlet classes are placed and tomcat has been started, any change in those classes won't reflect as they will not be reloaded (in default settings). This behavior is annoying for a developer who is making changes and wants to see them. This can be easily overcome by adding the "reloadable" attribute to your application's Context element, either in its Context fragment or in Server.xml:

<Context ...="" reloadable="true">

After making this change, restart the tomcat server and try to place newly compiled classes. You should be able to see reloading lines in tomcat's log.

Apache Tomcat server can be downloaded from its official site http://tomcat.apache.org/

No comments: