I'm developing a web-based Java application at work and (obviously) have to run it locally during development. I've figured out the Tomcat docs and have a suitable context.xml file in /etc/tomcat6/Catalina/localhost/ but every so often, Tomcat decides to delete it! Which means I have to put it back and restart Tomcat.

Why does it do this? I have searched the Tomcat docs about it and am none the wiser.

(Oh yes: it's not actually called context.xml but owners.xml as that's the HTTP path prefix for this application.)

Update

I've now seen Tomcat delete the file whilst Tomcat was running. I think I need to file a bug...

link|improve this question
feedback

3 Answers

Cant answer the Why bit.

However, This link states you can stop this by setting the autoDeploy="false" in server.xml

link|improve this answer
feedback

I honestly dont know what the reasoning behind Tomcat doing this is but try adding the following XML attribute to your context element

reloadable="false"

So your context could look something like this:

<Context path="/" docBase="/some/path/name" reloadable="false">
<!-- Context related stuff -->
</Context>

This should keep Tomcat from deleting the file

link|improve this answer
Unfortunately, that makes development harder as I would have to restart Tomcat after each build. – staticsan Oct 20 '10 at 22:42
checkout jrebel to help with this in development: zeroturnaround.com/jrebel – harmanjd Dec 8 '11 at 16:33
feedback

Have this problem to. Seems like when you replace your war it causes undeployment of the app which causes deletion of the context file. I don't have a work-around but would love to have one which is more convenient than reloadable=false

http://stackoverflow.com/questions/4032773/why-does-tomcat-replace-context-xml-on-redeploy

link|improve this answer
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.