迁移到 tomcat 8 别名后不再起作用 [英] After migrating to tomcat 8 aliases doesn't work any more
本文介绍了迁移到 tomcat 8 别名后不再起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在尝试将我们的应用从 tomcat 7 迁移到 tomcat 8 后,我们发现别名不再像以前那样工作了.
after trying to migrate our app from tomcat 7 to tomcat 8 we have found that aliases does not work as before.
这是 context.xml 文件的内容:
Here is a content of context.xml file:
<Context reloadable="true"
aliases="/d1=C://dir1,/d2=C://temp//dir2//,/d3=C://temp//dir3//" >
<Valve className="org.apache.catalina.valves.RemoteAddrValve" allow=".*" />
</Context>
在 tomcat 7 上,我可以使用这些网址:
On tomcat 7 I can ropen this urls:
http://localhost:8080/myapp/d2/data.xml
http://localhost:8080/myapp/d3/data.png
在 tomcat 8 上出现 404 错误.
On tomcat 8 I get 404 error.
有什么想法吗?
谢谢.
推荐答案
我找到了解决方案.问题出在 context.xml 中.
I have found a solution. Problem was in context.xml.
要让别名在 tomcat 8 上工作,需要更改 context.xml:
To make alias work on tomcat 8 here is required change in context.xml:
<Context reloadable="true" >
<Resources>
<PreResources base="C://dir1" className="org.apache.catalina.webresources.DirResourceSet" webAppMount="/d1" />
<PreResources base="C://temp//dir2//" className="org.apache.catalina.webresources.DirResourceSet" webAppMount="/d2" />
<PreResources base="C://temp//dir3//" className="org.apache.catalina.webresources.DirResourceSet" webAppMount="/d3" />
</Resources>
<Valve className="org.apache.catalina.valves.RemoteAddrValve" allow=".*" />
</Context>
这篇关于迁移到 tomcat 8 别名后不再起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文