1

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...

Tim
  • 31
  • 1
  • 4

2 Answers2

2

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.

Community
  • 1
  • 1
Tim
  • 31
  • 1
  • 4
1

You need to undeploy your web application and then re-deploy it. Tomcat is re-using the context.xml file you provided on initial deployment, which you can find in CATALINA_BASE/conf/[engine]/[host]/[context].xml. The changes you are making to your own context.xml are probably being completely ignored.

Christopher Schultz
  • 20,221
  • 9
  • 60
  • 77
  • Thank you for your reply. According to your answer and this question [link](http://stackoverflow.com/questions/318241/tomcat-context-xml-files-is-there-a-hiearchy?rq=1) I find the way to solve this problem. – Tim Jul 21 '13 at 13:49