aspose file tools*
The moose likes Tomcat and the fly likes Deployment of Web Application Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » Tomcat
Bookmark "Deployment of Web Application" Watch "Deployment of Web Application" New topic

Deployment of Web Application

Lakshman Easwaran

Joined: Jun 27, 2005
Posts: 4
I deploy an application in Tomcat thats runs on remote server from a local path as below:


Is there a way that I can put my context xml file in war file and use the above method to deploy my application so that Tomcat automatically picks up context xml file from the war file?

ie., just by using this


Let me know if I am not making my question clear.

Ulf Dittmer

Joined: Mar 22, 2005
Posts: 42952
I didn't know you could deploy the context file; that's neat.
But I doubt you can get it into the war file, because that file is simply exploded in the webapps directory, and what's more, its contents are defined in the Servlet specification. The context file, on the other hand, is completely Tomcat-specific. Including it in the war file would negate the benefit of standardized war files.
Craig Jackson
Ranch Hand

Joined: Mar 19, 2002
Posts: 405
I hope, I understand you correctly. But couldn't you place the context.xml in the META-INF directory of your WEB application, rebuild your WAR file and then deploy it?

And true, this will only apply to the Tomcat container.
Lakshman Easwaran

Joined: Jun 27, 2005
Posts: 4
Craig and Ulf,

Thanks for your replies.

Even after placing context.xml in META-INF directory, context xml is not deployed correctly after deployment.

Any other ideas?

Lakshman Easwaran

Joined: Jun 27, 2005
Posts: 4
Craig was right. One has to put context.xml in META-INF and include that in the war file. After that put the war file in TOMCAT_HOME/webapps and restart Tomcat. This will correctly deploy the context.xml to TOMCAT_HOME/conf/Catalina/<host-name> under the name of web application.

If you use URL method to deploy webapplication, like the one mentioned in my first posting in this topic, context.xml will not be deployed correctly.
Victor Thomson

Joined: Aug 23, 2005
Posts: 5
So does this mean that if you use the catalina-ant deploy task in your build.xml to deploy your war file, and if you have a context.xml file in META-INF, that the application will not deploy correctly? I think it uses the URL method and have been struggling trying to get this to work...


Consider Paul's rocket mass heater.
subject: Deployment of Web Application