Created
September 11, 2012 11:35
-
-
Save ae6rt/3697746 to your computer and use it in GitHub Desktop.
The four ways to deploy a webapp to Tomcat
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
There are four different ways one can deploy a webapp to Tomcat. If TCHOME is the Tomcat top-level directory: | |
* Copy the war file foo.war or exploded war directory to TCHOME/webapps | |
* Create a context file context.xml in the webapp’s META-INF/ directory that contains a <Context> fragment that describes the webapp deployment | |
* Add a <Context> element to the <Host> element in Tomcat’s server.xml that describes the webapp deployment, including docBase. docBase is a <Context> attribute that locates the war file or exploded war directory in the filesystem. | |
* Create a context file foo.xml in TCHOME/conf/Catalina/localhost/foo.xml that contains a <Context> fragment that describes the webapp deployment, including docBase. | |
The first two methods do not provide the freedom to name the servlet context independent of file system names for the war file or exploded war directory, whereas the last two do. Of the two methods that provide control over context naming, the most appealing is the use of a context file foo.xml placed in TCHOME/conf/Catalina/localhost/foo.xml, as it avoids modifying the stock server.xml file for pure context deployment purposes. For the root context “/”, the context file name is ROOT.xml. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment