Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

prevent tomcat 7 from deleting my custom context file on every single overwrite/undeploy of my webapp

I have a web application deployed on tomcat 7. Its context file, named myAppName.xml is located in $CATALINA_HOME/conf/Catalina/localhost folder.

The problem I'm facing is that on each overwrite or undeploy, my configuration file is deleted from $CATALINA_HOME/conf/Catalina/localhost folder and I have to copy/paste it from a backup location.

How can I prevent this behavior? I don't want to copy/paste context file everytime I change something in webapp.

like image 502
mariami Avatar asked Feb 27 '13 11:02

mariami


People also ask

What is context tomcat?

What is a Tomcat Context. In Tomcat, the Context Container represents a single web application running within a given instance of Tomcat. A web site is made up of one or more Contexts. For each explicitly configured web application, there should be one context element either in server.

How does Tomcat define docBase?

The docBase attribute is a path to the WAR file or exploded deployment directory. It is relative to the webapps directory, although an absolute path can be used. The path attribute is the one we are most interested in, as it defines the context path of the application.

What is context in apache?

The Context element represents a web application, which is run within a particular virtual host. Each web application is based on a Web Application Archive (WAR) file, or a corresponding directory containing the corresponding unpacked contents, as described in the Servlet Specification (version 2.2 or later).


1 Answers

Put it into web/META-INF in the source tree, then Tomcat will copy it out of there into conf/.... on each deploy. Tomcat 7 won't even do that by default, just use it where it is.

like image 90
user207421 Avatar answered Oct 16 '22 23:10

user207421