Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

about context file

 
david hu
Ranch Hand
Posts: 143
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.

Thanks,

David
 
Ray Stojonic
Ranch Hand
Posts: 326
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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)
 
vishwanath nadimpally
Ranch Hand
Posts: 116
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic