javatomcatcross-context

How to change the default value of context.xml in Tomcat?


I am trying to use the crossContext feature in Tomcat so that I need to set <Context crossContext="true"> in the context.xml file located in mypath\apache-tomcat-7.0.41\conf folder.

However I find that every time I restart tomcat it will restore to its original value then I have to modify that again. I want to know if there is a way to avoid this so that I do not need to modify the context.xml file every time I restart Tomcat?

Thanks in advance!

<Context crossContext="true">
<WatchedResource>WEB-INF/web.xml</WatchedResource>
<Manager pathname="" />
</Context>

above is the code I am using...


Solution

  • According the the answer in this question [link] Tomcat context.xml files, is there a hiearchy? I figured out the way to solve this problem. Just create the context.xml file in the location mypath\apache-tomcat-7.0.41\conf\Catalina\localhost and add in <Context crossContext="true"> </Context> then you are done.