简体   繁体   中英

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).

I would also like this setting to be outside the war (I found this SO question , but the configuration is within the war).

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 :

<?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. Use ROOT to place at /

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM