TomRed.net

  • Increase font size
  • Default font size
  • Decrease font size
Subscribe Bookmark and Share
Home Tutorials Other Tomcat Deletes Context XML files

Tomcat Deletes Context XML files

User Rating: / 0
PoorBest 

Apache Tomcat 5/6 deletes your context .xml file when you shutdown Tomcat.  This one plagued a colleague of mine for a month before he blew his top.  Essentially each time you stop Tomcat it deletes the file.  Every now and then it doesn't and you can work out why it isn't doing it for the rest of you team.  Having been on the receiving end of this pain in the neck also I decided to have a look into it.

Like everything in development and systems admin, you will find the solution is often easier then you think.  The solution to this problem is that in $tomcat_home/conf/server.xml (where $tomcat_home is where you installed Tomcat) there is a line near the end as follows:

autoDeploy="true" xmlValidation="false" xmlNamespaceAware="false">

The area marked in read autoDeploy="true" is the culprit and simply setting this to false will solve the problem.  I have looked into it and it seems that there is no consensus on what is the cause but it is believed that the issue stems from the fact that Tomcat didn't shutdown correctly or (more likely) as it is set to autoDeploy it expects the *.war file etc to be provided again in the webapps directory and not specified in a context.

For completeness this is output that should stop the destruction of your context files by Tomcat.

autoDeploy="false" xmlValidation="false" xmlNamespaceAware="false">

I hope this has helped, if you have any questions leave a comment below or contact me support[@]tomred.net.