• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

More one context.xml in a Webapp

 
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

I use a context.xml file to set jndi resources for a webapp. I have a question.

Suppose I set resources for the webapp in the context.xml file in $CATALINA_HOME/conf/.

Then I put resources in the <CONTEXTPATH>.xml file and copy the file in
$CATALINA_HOME/conf/[enginename]/[hostname]/.

Finally I deploy my webapp and this webapp has a file context.xml in /META-INF dir.

Which of three files is read by Tomcat?


 
Enrico Oliosi
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Mybe I have found a solution:

from this mailing list I read "If a <contextpath>.xml exists,
it always takes priority over anything in a WAR or an exploded directory."

If you are interesting about other informations I suggest you to read: Tomcat Configuration Reference
 
Saloon Keeper
Posts: 27752
196
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Here's the priorities, from low to high:

1. META-INF/context.xml in a WAR file
2. META-INF/context.xml in webapps/xxx (WAR) directory
3. conf/Catalina/localhost/xxx.xml (Context file) where "localhost" is replaced by alternative hostnames for more complex server setups.
4. DON'T put a context in server.xml!

An exploded WAR takes priority over a WAR file, even if the WAR file is newer. A characteristic of Tomcat that's caused me grief more than once, since it also means that a replacement WAR won't be exploded to take the place of an older exploded WAR.
 
Enrico Oliosi
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Thanks Tim for your answer
 
reply
    Bookmark Topic Watch Topic
  • New Topic