File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Tomcat and the fly likes Auto Reload of servlet after compilation Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » Tomcat
Bookmark "Auto Reload of servlet after compilation" Watch "Auto Reload of servlet after compilation" New topic

Auto Reload of servlet after compilation

Bharath Chinnadurai Maharajan

Joined: Dec 22, 2004
Posts: 26

I use tomcat 4 LE for jdk 1.4. I face a problem like, i had to restart the server each time after modifying and recompiling my servlet. So after doing a small research i found out dis could be solved by adding de following stmt in the server.xml file,

<DefaultContext relodable="true"/>

but even after dis, my servlet is not automatically reloaded.

I tested with jsp and html files, they worked perfectly allright, iam facing trouble only with my servlets.

I also have my browser setting to "check for newer version of the stored page each time i visit the page". But even dis dint help.

Is there any thing i can do abt dis, dis stuff is driving me nuts .

Bharath Chinnadurai
SCJP 1.4

Craig Jackson
Ranch Hand

Joined: Mar 19, 2002
Posts: 405
Correct me if I am mistaken, but the modification of the server.xml will require a restart of Tomcat each time you modify the server.xml and from what I understand it is NOT recommended to place <Context> elements directly in the server.xml file. Instead, put them in the META-INF/context.xml directory of your WAR file or in the $CATALINA_HOME/conf directories.
Bharath Chinnadurai Maharajan

Joined: Dec 22, 2004
Posts: 26
hi Craig,

thx for ur reply. B4 working on ur reply i came across an article which says a different way to reload the servlet after compilation without restarting the tomcat app server. We have to give the url like,


where servlet is my invoker servlet and ReloadServlet is my servlet which has just been modified and re-compiled.

Iam not sure how dis will work b'cos i encounter a different problem now. The moment i give the above url iam prompted for a username and passwd. Iam using binary version of tomcat and iam sure i dint gave any userame or passwd while i configured tomcat. Also i scaned my server.xml file, but dint got hold of any useful stuff. Also i gave my windows username and passwd, all failed.

what is actually dis abt........ wat username and passwd shud i provide to test dis stuff.

Bharath Chinnadurai Maharajan
SCJP 1.4
William Brogden
Author and all-around good cowpoke

Joined: Mar 22, 2000
Posts: 13036
The manager application requires a password - no default is provided as a security measure. All of this is documented in the tomcat-docs that are typically installed with your tomcat - you might as well learn to use them.
[ May 25, 2005: Message edited by: William Brogden ]
I agree. Here's the link:
subject: Auto Reload of servlet after compilation
It's not a secret anymore!