Under what circumstances will a servlet be reloaded?

swarraj kulkarni

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.

There are many good answers here at jGuru related to this question. You may find them useful:
Servlet reload problem

Comment and Contribute

 

 

 

 

 


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

 

 

About | Sitemap | Contact