top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

Under what circumstances will a servlet be reloaded?

+2 votes
318 views
Under what circumstances will a servlet be reloaded?
posted Jan 7, 2016 by Shyam

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button

1 Answer

0 votes

That depends on the Servlet container.

Most of the Servlet containers reload the servlet only it detects the code change in the Servlet, not in the referenced classes.
In Tomcat’s server.xml deployment descriptor, if you have mentioned

          <Context path="/myApp"
                         docBase="D:/myApp/webDev"
                           crossContext="true"
                           debug="0"
                           reloadable="true"
                           trusted="false" >
          </Context>

The reloadable = true makes the magic. Every time the Servlet container detects that the Servlet code is changed, it will call the destroy on the currently loaded Servlet and reload the new code.
But if the class that is referenced by the Servlet changes, then the Servlet will not get loaded. You will have to change the timestamp of the servlet or stop-start the server to have the new class in the container memory.

answer Jan 8, 2016 by Karthick.c
...