迁移到tomcat 8后,别名不再起作用 [英] After migrating to tomcat 8 aliases doesn't work any more

查看:155
本文介绍了迁移到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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆