tomcat 下存在一个temp文件夹,通过
ln -s /wwwtemp/ /home/app/xxx/temp
软连接过来,发现在访问的时候是404,找不到
解决办法:
在tomcat 的conf/context.xml中配置allowLinking=”true”
其中tomcat 8 一下直接在Context标签上配置allowLinking=”true”即可
tomcat 8,9在Context标签中增加
<Resources allowLinking="true"/>
即可。
其他解决办法:
在项目的META-INF目录中增加context.xml文件,并添加一下内容:
<?xml version="1.0" encoding="UTF-8"?>
<Context path="/yourApp" allowLinking="true"></Context>
效果相同。
或者直接在tomcat/conf/Catalina/localhost/下添加文件
xxx.xml,内容同上,
xxx为你的项目名