tomcat relative paths settings

懵懂的女人 提交于 2019-12-12 05:14:15

问题


I have deployed a app on tomcat. Some of the libraries used by the app use relative paths to resources. Therefore, they search the resources in TOMCAT-HOME/relative-path. I can not create links nor copy resources to TOMCAT-HOME folder. Also I can not change the code of the libraries and use application context. Can I somewhere in Tomcat configuration specify the "working directory" for this app alone. I've tried using Context container, but I can not get my head around it. Thanks.


回答1:


You need something like this inside your server.xml

<Context cachingAllowed="false" docBase="C:\ProgramFiles\ApacheSoftwareFoundation\apache-tomcat-5.5.29\temp" path="/tmpimages" privileged="true">
  </Context>

and use /tmpimages inside your source code.




回答2:


From the question you have asked , i can understand that you have problems accessing the TOMCAT-HOME folder . Why dont you try adding a ../ in front of all the paths that wants to access the TOMCAT-HOME folder ?



来源:https://stackoverflow.com/questions/5183967/tomcat-relative-paths-settings

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!