Reputation: 802
Using the Tomcat Web Application Manager, I can stop, start, reload & undeploy particular applications. Any applications that I stop in this way, automatically start again when Tomcat itself is restarted.
How can I configure a particular application to NOT start when Tomcat starts, and only start when I start it myself via Web Application Manager?
Upvotes: 4
Views: 1979
Reputation: 14678
There is deployIgnore
attribute in Host
element of server.xml.
It accepts regexp of context to NOT deploy.
Reference here:
A regular expression defining paths to ignore when autoDeploy and deployOnStartup are set. This allows you to keep your configuration in a version control system, for example, and not deploy a .svn or CVS folder that happens to be in the appBase.
This regular expression is relative to appBase. It is also anchored, meaning the match is performed against the entire file/directory name. So, foo matches only a file or directory named foo but not foo.war, foobar, or myfooapp. To match anything with "foo", you could use .foo..
Some more explanation here :
Any web application archive file within the Host's appBase directory that has not already been deployed as a result of a context XML descriptor, does not have a corresponding directory of the same name (without the ".war" extension), and is not excluded by deployIgnore will be deployed next. The context path used will be a slash character ("/") followed by the web application archive name less the ".war" extension. The one exception to this rule is that a web application archive named "ROOT.war" will be deployed with a context path of /. Multi-level contexts may be defined by using #, e.g. use a WAR named foo#bar.war for a context path of /foo/bar.
UPDATE
To prove my answer I tried to answer @rgh comment bellow.
Just downloaded recent version of Tomcat8 (8.0.30). It does ship (among others) with web application "examples".
Start without any modification (excerpt from catalina.out):
Deploying web application directory /home/opt/apache-tomcat-8.0.30/webapps/examples
Deployment of web application directory /home/opt/apache-tomcat-8.0.30/webapps/examples has finished in 256 ms
Start with modified server.xml with snipped:
<Host name="localhost" appBase="webapps" deployIgnore="^examples$" unpackWARs="true" autoDeploy="true">
Prevents application "examples" to be deployed.
So in your case, try this
<Host name="localhost" appBase="webapps" deployIgnore="^welcome$" unpackWARs="true" autoDeploy="true">
Upvotes: 2
Reputation: 20882
You need to set deployOnStartup="false"
on your <Host
> element in conf/server.xml
. Note that this will cause the manager
application to also not deploy on startup. You have a few options for that:
<Context>
in conf/server.xml
<Host>
with deployOnStartup="true"
and deploy the manager to that host insteadThe Automatic Deployment Documentation is a pretty good resource to see what combinations of events and configurations will exhibit what behavior.
Upvotes: 2