1 - The context.xml file is used to describe and setup a context.
2 - The use of a context.xml is new to Tomcat 5.x. In previous versions, the context was added to server.xml and required Tomcat to be restarted to take effect. Now, with the context.xml, we can deploy, redeploy and undeploy contexts without restarting Tomcat.
3 - Only add a context to one place, which place depends on the version of Tomcat you're using.
Joined: Dec 09, 2005
Hi, Ray Stojonic thanks for the reply. When i place the complete project folder directly inside my C:\ and set the context under the "server.xml" and when i start the tomcat i can see my project started by tomcat.
but instead of setting the context in the "server.xml" if i set that in "META-INF/context.xml" and when i start the tomcat i can't see my project running.
i think i'am missing some setting here.
let me know aht should i do.
Joined: Aug 08, 2003
Ah, I should have mentioned this before...
For the context.xml to be properly deployed from META-INF to the Tomcat conf directory, (which also includes renaming the context.xml to <Your Context Name>.xml) the context must be deployed through Tomcat manager, as a .war file (Web Application Archive)
If you want to deploy it yourself by copying the files to the webapps directory, you'll need to do it this way:
- stop Tomcat - copy your context to CATALINA_HOME/webapps - copy your context.xml to CATALINA_HOME/conf/Localhost(?) - I'm not at my development computer at the moment, I forget the full path to the directory, just go to conf and drill down until you see .xml files - rename your context.xml to <Your Context Name>.xml (this must match what's defined in the context.xml) - restart Tomcat
Once you've deployed it the first time, you won't need to copy the context.xml every time, only when you've made changes to it.
If you're interested in using a war to deploy, simply zip your context directory, rename it to <Your Context Name>.war then use Tomcat manager to deploy it.