I have two context files as main-context.xml and sub-context.xml. I would like to import/include sub-context.xml into main-context.xml.
Is it possible to inject a context.xml into another context.xml in Tomcat?
main-context.xml:
<?xml version="1.0" encoding="UTF-8"?>
<Context>
<Valve className="org.apache.catalina.valves.rewrite.RewriteValve"/>
<Resource name="mainDs" auth="Container"
type="javax.sql.DataSource"
driverClassName="oracle.jdbc.OracleDriver"
url="jdbc:oracle:thin:@localdomain:1521/test"
username="test_username" password="test_password"
maxTotal="20"
maxIdle="10"
maxWaitMillis="-1"
validationQuery="SELECT 1 FROM DUAL"
validationQueryTimeout="3"
testOnBorrow="true"
testWhileIdle="true"
defaultTransactionIsolation="2" />
<!-- Default set of monitored resources. If one of these changes, the -->
<!-- web application will be reloaded. -->
<WatchedResource>WEB-INF/web.xml</WatchedResource>
<WatchedResource>WEB-INF/tomcat-web.xml</WatchedResource>
<WatchedResource>${catalina.base}/conf/web.xml</WatchedResource>
<!-- Uncomment this to disable session persistence across Tomcat restarts -->
<!--
<Manager pathname="" />
-->
</Context>
sub-context.xml:
<Resource name="subDs" auth="Container"
type="javax.sql.DataSource"
driverClassName="oracle.jdbc.OracleDriver"
url="jdbc:oracle:thin:@localdomain:1521/testsub"
username="testsub_username" password="testsub_password"
maxTotal="20"
maxIdle="10"
maxWaitMillis="-1"
validationQuery="SELECT 1 FROM DUAL"
validationQueryTimeout="3"
testOnBorrow="true"
testWhileIdle="true"
defaultTransactionIsolation="2" />