Search code examples
javatomcatcontext.xmlmeta-inf

Which context.xml is used First


On my Tomcat 6.0.x I have a context.xml file in the conf directory and I also have a context.xml in the META-INF directory of a project deployed from netbeans6.9.1.

The context.xml contains the details of database to be connected...

Which among the two will be used by the application to connect to the database

  • Context.xml in tomcat/conf
  • Context.xml in project/META-INF

Solution

  • My understanding is that tomcat/conf/context.xml defines a set of "global", statically-configured contexts. Any WAR deployed with its own context.xml will be configured using that, rather than any of the contexts defined in the global one.