[英]Can I have an application specific classpath directory in tomcat 7, configured outside the war?
I would like to have an additional classpath directory in tomcat 7, like what can be done by adding ${catalina.home}/mydir
in catalina.properties, but specific to an application (war). 我想在tomcat 7中有一个附加的classpath目录,例如可以通过在catalina.properties中添加
${catalina.home}/mydir
来完成,但是特定于应用程序(战争)。
I would also like this setting to be outside the war (I found this SO question , but the configuration is within the war). 我还希望此设置不在战争范围内(我发现了这个SO问题 ,但配置在战争范围内)。
I my case, it is to have two environments (say integration and QA) on the same container, with different configurations. 我的情况是,在同一容器上有两个环境(例如集成和质量保证),配置不同。 I wish to keep the artifacts environment agnostic, so not changing the path to the configuration files (properties, logback, ...).
我希望保持工件环境不可知,因此不要更改配置文件的路径(属性,登录等)。
Can this be done ? 能做到吗? How ?
怎么样 ?
Thank you. 谢谢。
VirtualWebappLoader https://stackoverflow.com/a/6410589/173149 : VirtualWebappLoader https://stackoverflow.com/a/6410589/173149 :
<?xml version="1.0" encoding="UTF-8"?>
<Context antiJARLocking="true" path="/websandbox">
<Loader className="org.apache.catalina.loader.VirtualWebappLoader"
virtualClasspath="/usr/.../*.jar;/usr/.../*.jar"/>
</Context>
This config can be placed in $CATALINF_ROOT/config/Catalina/localhost/$PREFIX.xml
where $PREFIX
is context of your application. 该配置可以放在
$CATALINF_ROOT/config/Catalina/localhost/$PREFIX.xml
,其中$PREFIX
是应用程序的上下文。 Use ROOT
to place at /
使用
ROOT
放置在/
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.