File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Tomcat and the fly likes Restarting issue when we edit context.xml Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Products » Tomcat
Bookmark "Restarting issue when we edit context.xml" Watch "Restarting issue when we edit context.xml" New topic
Author

Restarting issue when we edit context.xml

Elan Ram
Ranch Hand

Joined: Dec 14, 2006
Posts: 40
Hi Folks,

One of the tomcat server in our project is restarting automatically when ever we edit the context.xml file. We have installed tomcat from redhat inbuilt package. Is this known issue or any body have come across similar issue in past?


Thanks and regards,
Elan
Kees Jan Koster
JavaMonitor Support
Rancher

Joined: Mar 31, 2009
Posts: 251
    
    5
This is expected behaviour from Tomcat. What makes you say this is an 'issue'?


Java-monitor, JVM monitoring made easy <- right here on Java Ranch
Elan Ram
Ranch Hand

Joined: Dec 14, 2006
Posts: 40
Hi Kees,

Thanks for your reply. My understanding is we need to restart the server manually if there are changes in server.xml or context.xml(Please correct me if i am wrong). I am not able to understand why is it happening automatically?
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 16095
    
  21

It doesn't "restart the server". Not unless you're running it under an IDE which is usurping Tomcat's normal functions.

It's restarting the webapp. Other webapps in the Tomcat server (and the Tomcat server itself) should remain unaffected.

This is basically Tomcat's "hot deploy" feature at work. Changing classfiles in the webapp or changing the deployment descriptor will cause the scanner in Tomcat to detect the change and redeploy (thus restarting) the webapp. At least unless you switch off the hot deploy feature.


Customer surveys are for companies who didn't pay proper attention to begin with.
Elan Ram
Ranch Hand

Joined: Dec 14, 2006
Posts: 40
Hi Tim,

Yes. I can accept your point. We are not allowing the hot deployment and not making any changes in the web application level. We are changing the configuration file at Tomcat server level. We observing the behavior of restarting the Tomcat server.
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

Search this page for the "reloadable" configuration.

Not sure where it's set on your system.


Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 16095
    
  21

I forgot to mention. The context XML file (Context element) is the Deployment Descriptor. Although originally it was embedded in the Tomcat configuration file (server.xml), that mode of operation has been discouraged since Tomcat 4.

And someday I hope that the people who do the Eclipse WST plugin will get the hint and do likewise.

Changing server.xml wouldn't trigger an automatic restart, although it also wouldn't dynamically detect deployment descriptor changes for the same reason (which is WHY that mode is discouraged).

However, changing the deployment descriptor itself would restart the app. That's regardless of whether you defined an external DD (conf/Catalina/localhost/xxxxx.xml) or internal (META-INF/context.xml). And actually, I'm not sure but what changing the deployment descriptor wouldn't be considered as grounds for restart even if hot-deploy is turned off, now that I think about it. Especially since it's well-known that Tomcat thinks it owns the external DDs and will actually delete them right out from under you if it decides it doesn't like them.
Elan Ram
Ranch Hand

Joined: Dec 14, 2006
Posts: 40
Hi,

Thanks all for your valuable knowledge sharing.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Restarting issue when we edit context.xml