[英]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. 我试图在Tomcat中使用
crossContext
功能,因此需要在mypath\\apache-tomcat-7.0.41\\conf
文件夹中的context.xml
文件中设置<Context crossContext="true">
。
However I find that every time I restart tomcat it will restore to its original value then I have to modify that again. 但是我发现,每次重新启动tomcat时,它将恢复到其原始值,然后我必须再次对其进行修改。 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? 我想知道是否有避免这种情况的方法,这样我每次重启Tomcat时都不需要修改
context.xml
文件吗?
Thanks in advance! 提前致谢!
<Context crossContext="true">
<WatchedResource>WEB-INF/web.xml</WatchedResource>
<Manager pathname="" />
</Context>
above is the code I am using... 以上是我正在使用的代码...
You need to undeploy your web application and then re-deploy it. 您需要取消部署Web应用程序,然后重新部署它。 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
. Tomcat正在重新使用您在初始部署中提供的
context.xml
文件,您可以在CATALINA_BASE/conf/[engine]/[host]/[context].xml
。 The changes you are making to your own context.xml are probably being completely ignored. 您对自己的context.xml所做的更改可能会被完全忽略。
According the the answer in this question [link] Tomcat context.xml files, is there a hiearchy? 根据此问题的链接[链接] Tomcat context.xml文件,是否有一个层次结构? 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. 只需在
mypath\\apache-tomcat-7.0.41\\conf\\Catalina\\localhost
位置中创建context.xml
文件,然后添加<Context crossContext="true"> </Context>
,即可完成操作。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.