File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Tomcat and the fly likes about context file Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » Tomcat
Bookmark "about context file " Watch "about context file " New topic

about context file

david hu
Ranch Hand

Joined: Jul 20, 2001
Posts: 143
Whenever tomcat started, it creats a context file called TEST.xml under the dir of TOMCAT_home/conf/Catalina/localhost, Can anyone tell me why?

I am curious about this, because not for all applications it creates this .xml file, only for one of my specific applications. I tried jsp_examples with the installation of tomcat, it does not create one .xml under this dir either.

My jsp and servlet application is under TOMCAT_home/webapps/TEST.


Ray Stojonic
Ranch Hand

Joined: Aug 08, 2003
Posts: 326
Presumably, you have a context.xml within the META-INF directory of your webapp. Tomcat will copy this file to the TOMCAT_home/conf/Catalina/localhost and rename it to the name of your context when you deploy the app via a war.
Ben Souther

Joined: Dec 11, 2004
Posts: 13410

Those files are called context fragments and they take the place of the Context entry in your server.xml.

The file should have the same name as your webapps (with the .xml extension)

Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
vishwanath nadimpally
Ranch Hand

Joined: Jan 25, 2005
Posts: 116
Additionally this "context".xml ("context" is your web-app name) is a very good place to configure resources like DB connections for the web-app.
I agree. Here's the link:
subject: about context file
It's not a secret anymore!