war包技巧 - META-INF/context.xml

Tomcat下war应用配置数据源又一方法
    把配置写于/META-INF/context.xml中,例:

<Context path="/axis2" privileged="true" antiResourceLocking="false" antiJARLocking="false">
    <ResourceLink
             name="jdbc/BPMSDB"
             global="BPMSDB"
             type="javax.sql.DataSource"
             />
</Context>

查看定义文件,comtext在tomcat5.5中可出现的位置有:

  • in the $CATALINA_HOME/conf/context.xml file: the Context element information will be loaded by all webapps
  • in the $CATALINA_HOME/conf/[enginename]/[hostname]/context.xml.default file: the Context element information will be loaded by all webapps of that host
  • in individual files (with a ".xml" extension) in the $CATALINA_HOME/conf/[enginename]/[hostname]/ directory. The name of the file (less the .xml) extension will be used as the context path. Multi-level context paths may be defined using #, e.g. context#path.xml. The default web application may be defined by using a file called ROOT.xml.
  • if the previous file was not found for this application, in an individual file at /META-INF/context.xml inside the application files
  • inside a Host element in the main conf/server.xml

你可能感兴趣的:(tomcat,xml,Web)