Why are my JSP changes are not reflected without restarting Tomcat?

Rakesh Juyal picture Rakesh Juyal · Jan 5, 2010 · Viewed 83k times · Source

I am editing JSP files which are residing directly inside tomcat/webapps/myapp/WEB-INF, but to see the changes, I have to restart the server. As far as I know, JSP changes don't require you to restart the server. The only configuration I found which is related to automatic reloading is reloadable = "true"

Set to true if you want Catalina to monitor classes in /WEB-INF/classes/ and /WEB-INF/lib for changes, and automatically reload the web application if a change is detected.

I used this attribute in the context.xml, but still the problem persists. What could be the other possible reason of not detecting changes in JSP files without restarting?

@Bozho: This is the excerpt from web.xml. Do I need to change something?

 <servlet>
        <servlet-name>jsp</servlet-name>
        <servlet-class>org.apache.jasper.servlet.JspServlet</servlet-class>
        <init-param>
            <param-name>fork</param-name>
            <param-value>false</param-value>
        </init-param>
        <init-param>
            <param-name>xpoweredBy</param-name>
            <param-value>false</param-value>
        </init-param>
        <load-on-startup>3</load-on-startup>
    </servlet>

Answer

Bozho picture Bozho · Jan 5, 2010

In the tomcat docs, see the development setting. It must be set to true in order to have jsps reloaded.

development - Is Jasper used in development mode? If true, the frequency at which JSPs are checked for modification may be specified via the modificationTestInterval parameter.true or false, default true.

This is in your CATALINA_HOME/conf/web.xml

Additionally, if you need to refresh a jsp in a production environment without restart, you can go to CATALINA_HOME/work/Catalina/localhost/contentName/org/apache/jsp and delete the your_jsp.java and your_jsp.class files. They will be recreated the next time they are accessed.

Edit: after providing your configuration, and comment about not refreshing the content, I have another though: clear your browser cache, or open the page from another browser.