| 刘洪青 | 6266f99 | 2017-05-15 21:21:03 +0800 | [diff] [blame^] | 1 | <html><head><META http-equiv="Content-Type" content="text/html; charset=iso-8859-1"><title>Apache Tomcat 7 (7.0.77) - Tomcat Web Application Deployment</title><meta name="author" content="Allistair Crossley"><style type="text/css" media="print">
 | 
 | 2 |     .noPrint {display: none;}
 | 
 | 3 |     td#mainBody {width: 100%;}
 | 
 | 4 | </style><style type="text/css">
 | 
 | 5 | code {background-color:rgb(224,255,255);padding:0 0.1em;}
 | 
 | 6 | code.attributeName, code.propertyName {background-color:transparent;}
 | 
 | 7 | 
 | 
 | 8 | 
 | 
 | 9 | table {
 | 
 | 10 |   border-collapse: collapse;
 | 
 | 11 |   text-align: left;
 | 
 | 12 | }
 | 
 | 13 | table *:not(table) {
 | 
 | 14 |   /* Prevent border-collapsing for table child elements like <div> */
 | 
 | 15 |   border-collapse: separate;
 | 
 | 16 | }
 | 
 | 17 | 
 | 
 | 18 | th {
 | 
 | 19 |   text-align: left;
 | 
 | 20 | }
 | 
 | 21 | 
 | 
 | 22 | 
 | 
 | 23 | div.codeBox pre code, code.attributeName, code.propertyName, code.noHighlight, .noHighlight code {
 | 
 | 24 |   background-color: transparent;
 | 
 | 25 | }
 | 
 | 26 | div.codeBox {
 | 
 | 27 |   overflow: auto;
 | 
 | 28 |   margin: 1em 0;
 | 
 | 29 | }
 | 
 | 30 | div.codeBox pre {
 | 
 | 31 |   margin: 0;
 | 
 | 32 |   padding: 4px;
 | 
 | 33 |   border: 1px solid #999;
 | 
 | 34 |   border-radius: 5px;
 | 
 | 35 |   background-color: #eff8ff;
 | 
 | 36 |   display: table; /* To prevent <pre>s from taking the complete available width. */
 | 
 | 37 |   /*
 | 
 | 38 |   When it is officially supported, use the following CSS instead of display: table
 | 
 | 39 |   to prevent big <pre>s from exceeding the browser window:
 | 
 | 40 |   max-width: available;
 | 
 | 41 |   width: min-content;
 | 
 | 42 |   */
 | 
 | 43 | }
 | 
 | 44 | 
 | 
 | 45 | div.codeBox pre.wrap {
 | 
 | 46 |   white-space: pre-wrap;
 | 
 | 47 | }
 | 
 | 48 | 
 | 
 | 49 | 
 | 
 | 50 | table.defaultTable tr, table.detail-table tr {
 | 
 | 51 |     border: 1px solid #CCC;
 | 
 | 52 | }
 | 
 | 53 | 
 | 
 | 54 | table.defaultTable tr:nth-child(even), table.detail-table tr:nth-child(even) {
 | 
 | 55 |     background-color: #FAFBFF;
 | 
 | 56 | }
 | 
 | 57 | 
 | 
 | 58 | table.defaultTable tr:nth-child(odd), table.detail-table tr:nth-child(odd) {
 | 
 | 59 |     background-color: #EEEFFF;
 | 
 | 60 | }
 | 
 | 61 | 
 | 
 | 62 | table.defaultTable th, table.detail-table th {
 | 
 | 63 |   background-color: #88b;
 | 
 | 64 |   color: #fff;
 | 
 | 65 | }
 | 
 | 66 | 
 | 
 | 67 | table.defaultTable th, table.defaultTable td, table.detail-table th, table.detail-table td {
 | 
 | 68 |   padding: 5px 8px;
 | 
 | 69 | }
 | 
 | 70 | 
 | 
 | 71 | 
 | 
 | 72 | p.notice {
 | 
 | 73 |     border: 1px solid rgb(255, 0, 0);
 | 
 | 74 |     background-color: rgb(238, 238, 238);
 | 
 | 75 |     color: rgb(0, 51, 102);
 | 
 | 76 |     padding: 0.5em;
 | 
 | 77 |     margin: 1em 2em 1em 1em;
 | 
 | 78 | }
 | 
 | 79 | </style></head><body bgcolor="#ffffff" text="#000000" link="#525D76" alink="#525D76" vlink="#525D76"><table border="0" width="100%" cellspacing="0"><!--PAGE HEADER--><tr><td><!--PROJECT LOGO--><a href="http://tomcat.apache.org/"><img src="./images/tomcat.gif" align="right" alt="
 | 
| Hongqing Liu | fd5ee81 | 2014-05-10 16:32:51 +0800 | [diff] [blame] | 80 |       The Apache Tomcat Servlet/JSP Container
 | 
| 刘洪青 | 6266f99 | 2017-05-15 21:21:03 +0800 | [diff] [blame^] | 81 |     " border="0"></a></td><td><h1><font face="arial,helvetica,sanserif">Apache Tomcat 7</font></h1><font face="arial,helvetica,sanserif">Version 7.0.77, Mar 28 2017</font></td><td><!--APACHE LOGO--><a href="http://www.apache.org/"><img src="./images/asf-logo.svg" align="right" alt="Apache Logo" border="0" style="width: 266px;height: 83px;"></a></td></tr></table><table border="0" width="100%" cellspacing="4"><!--HEADER SEPARATOR--><tr><td colspan="2"><hr noshade size="1"></td></tr><tr><!--LEFT SIDE NAVIGATION--><td width="20%" valign="top" nowrap class="noPrint"><p><strong>Links</strong></p><ul><li><a href="index.html">Docs Home</a></li><li><a href="http://wiki.apache.org/tomcat/FAQ">FAQ</a></li><li><a href="#comments_section">User Comments</a></li></ul><p><strong>User Guide</strong></p><ul><li><a href="introduction.html">1) Introduction</a></li><li><a href="setup.html">2) Setup</a></li><li><a href="appdev/index.html">3) First webapp</a></li><li><a href="deployer-howto.html">4) Deployer</a></li><li><a href="manager-howto.html">5) Manager</a></li><li><a href="realm-howto.html">6) Realms and AAA</a></li><li><a href="security-manager-howto.html">7) Security Manager</a></li><li><a href="jndi-resources-howto.html">8) JNDI Resources</a></li><li><a href="jndi-datasource-examples-howto.html">9) JDBC DataSources</a></li><li><a href="class-loader-howto.html">10) Classloading</a></li><li><a href="jasper-howto.html">11) JSPs</a></li><li><a href="ssl-howto.html">12) SSL/TLS</a></li><li><a href="ssi-howto.html">13) SSI</a></li><li><a href="cgi-howto.html">14) CGI</a></li><li><a href="proxy-howto.html">15) Proxy Support</a></li><li><a href="mbeans-descriptors-howto.html">16) MBeans Descriptors</a></li><li><a href="default-servlet.html">17) Default Servlet</a></li><li><a href="cluster-howto.html">18) Clustering</a></li><li><a href="balancer-howto.html">19) Load Balancer</a></li><li><a href="connectors.html">20) Connectors</a></li><li><a href="monitoring.html">21) Monitoring and Management</a></li><li><a href="logging.html">22) Logging</a></li><li><a href="apr.html">23) APR/Native</a></li><li><a href="virtual-hosting-howto.html">24) Virtual Hosting</a></li><li><a href="aio.html">25) Advanced IO</a></li><li><a href="extras.html">26) Additional Components</a></li><li><a href="maven-jars.html">27) Mavenized</a></li><li><a href="security-howto.html">28) Security Considerations</a></li><li><a href="windows-service-howto.html">29) Windows Service</a></li><li><a href="windows-auth-howto.html">30) Windows Authentication</a></li><li><a href="jdbc-pool.html">31) Tomcat's JDBC Pool</a></li><li><a href="web-socket-howto.html">32) WebSocket</a></li></ul><p><strong>Reference</strong></p><ul><li><a href="RELEASE-NOTES.txt">Release Notes</a></li><li><a href="config/index.html">Configuration</a></li><li><a href="api/index.html">Tomcat Javadocs</a></li><li><a href="servletapi/index.html">Servlet Javadocs</a></li><li><a href="jspapi/index.html">JSP 2.2 Javadocs</a></li><li><a href="elapi/index.html">EL 2.2 Javadocs</a></li><li><a href="websocketapi/index.html">WebSocket 1.1 Javadocs</a></li><li><a href="http://tomcat.apache.org/connectors-doc/">JK 1.2 Documentation</a></li></ul><p><strong>Apache Tomcat Development</strong></p><ul><li><a href="building.html">Building</a></li><li><a href="changelog.html">Changelog</a></li><li><a href="http://wiki.apache.org/tomcat/TomcatVersions">Status</a></li><li><a href="developers.html">Developers</a></li><li><a href="architecture/index.html">Architecture</a></li><li><a href="funcspecs/index.html">Functional Specs.</a></li><li><a href="tribes/introduction.html">Tribes</a></li></ul></td><!--RIGHT SIDE MAIN BODY--><td width="80%" valign="top" align="left" id="mainBody"><h1>Tomcat Web Application Deployment</h1><table border="0" cellspacing="0" cellpadding="2"><tr><td bgcolor="#525D76"><font color="#ffffff" face="arial,helvetica.sanserif"><a name="Table of Contents"><!--()--></a><a name="Table_of_Contents"><strong>Table of Contents</strong></a></font></td></tr><tr><td><blockquote>
 | 
| Hongqing Liu | fd5ee81 | 2014-05-10 16:32:51 +0800 | [diff] [blame] | 82 | <ul><li><a href="#Introduction">Introduction</a></li><li><a href="#Installation">Installation</a></li><li><a href="#A_word_on_Contexts">A word on Contexts</a></li><li><a href="#Deployment_on_Tomcat_startup">Deployment on Tomcat startup</a></li><li><a href="#Deploying_on_a_running_Tomcat_server">Deploying on a running Tomcat server</a></li><li><a href="#Deploying_using_the_Tomcat_Manager">Deploying using the Tomcat Manager</a></li><li><a href="#Deploying_using_the_Client_Deployer_Package">Deploying using the Client Deployer Package</a></li></ul>
 | 
 | 83 | </blockquote></td></tr></table><table border="0" cellspacing="0" cellpadding="2"><tr><td bgcolor="#525D76"><font color="#ffffff" face="arial,helvetica.sanserif"><a name="Introduction"><strong>Introduction</strong></a></font></td></tr><tr><td><blockquote>
 | 
 | 84 |         <p>
 | 
 | 85 |             Deployment is the term used for the process of installing a web
 | 
| 刘洪青 | 6266f99 | 2017-05-15 21:21:03 +0800 | [diff] [blame^] | 86 |             application (either a 3rd party WAR or your own custom web application)
 | 
 | 87 |             into the Tomcat server.
 | 
| Hongqing Liu | fd5ee81 | 2014-05-10 16:32:51 +0800 | [diff] [blame] | 88 |         </p>
 | 
 | 89 |         <p>
 | 
 | 90 |             Web application deployment may be accomplished in a number of ways
 | 
| 刘洪青 | 6266f99 | 2017-05-15 21:21:03 +0800 | [diff] [blame^] | 91 |             within the Tomcat server.
 | 
 | 92 |         </p>
 | 
| Hongqing Liu | fd5ee81 | 2014-05-10 16:32:51 +0800 | [diff] [blame] | 93 |         <ul>
 | 
 | 94 |                 <li>Statically; the web application is setup before Tomcat is started</li>
 | 
 | 95 |                 <li>
 | 
 | 96 |                     Dynamically; by directly manipulating already deployed web
 | 
 | 97 |                     applications (relying on <em>auto-deployment</em>
 | 
 | 98 |                     feature) or remotely by using the Tomcat Manager web
 | 
 | 99 |                     application
 | 
 | 100 |                 </li>
 | 
 | 101 |         </ul>
 | 
 | 102 |         <p>
 | 
 | 103 |             The <a href="manager-howto.html">Tomcat Manager</a> is a web
 | 
 | 104 |             application that can be used interactively (via HTML GUI) or
 | 
 | 105 |             programmatically (via URL-based API) to deploy and manage web
 | 
 | 106 |             applications.
 | 
 | 107 |         </p>
 | 
 | 108 |         <p>
 | 
 | 109 |             There are a number of ways to perform deployment that rely on
 | 
 | 110 |             the Manager web application. Apache Tomcat provides tasks
 | 
 | 111 |             for Apache Ant build tool.
 | 
| 刘洪青 | 6266f99 | 2017-05-15 21:21:03 +0800 | [diff] [blame^] | 112 |             <a href="http://tomcat.apache.org/maven-plugin.html">Apache Tomcat Maven Plugin</a>
 | 
| Hongqing Liu | fd5ee81 | 2014-05-10 16:32:51 +0800 | [diff] [blame] | 113 |             project provides integration with Apache Maven.
 | 
 | 114 |             There is also a tool called the Client Deployer, which can be
 | 
 | 115 |             used from a command line and provides additional functionality
 | 
 | 116 |             such as compiling and validating web applications as well as
 | 
 | 117 |             packaging web application into web application resource (WAR)
 | 
 | 118 |             files.
 | 
 | 119 |         </p>
 | 
 | 120 |     </blockquote></td></tr></table><table border="0" cellspacing="0" cellpadding="2"><tr><td bgcolor="#525D76"><font color="#ffffff" face="arial,helvetica.sanserif"><a name="Installation"><strong>Installation</strong></a></font></td></tr><tr><td><blockquote>
 | 
 | 121 |         <p>
 | 
 | 122 |             There is no installation required for static deployment of web
 | 
 | 123 |             applications as this is provided out of the box by Tomcat. Nor is any
 | 
| 刘洪青 | 6266f99 | 2017-05-15 21:21:03 +0800 | [diff] [blame^] | 124 |             installation required for deployment functions with the Tomcat Manager,
 | 
 | 125 |             although some configuration is required as detailed in the
 | 
| Hongqing Liu | fd5ee81 | 2014-05-10 16:32:51 +0800 | [diff] [blame] | 126 |             <a href="manager-howto.html">Tomcat Manager manual</a>.
 | 
 | 127 |             An installation is however required if you wish
 | 
| 刘洪青 | 6266f99 | 2017-05-15 21:21:03 +0800 | [diff] [blame^] | 128 |             to use the Tomcat Client Deployer (TCD).
 | 
 | 129 |         </p>
 | 
| Hongqing Liu | fd5ee81 | 2014-05-10 16:32:51 +0800 | [diff] [blame] | 130 |         <p>
 | 
| 刘洪青 | 6266f99 | 2017-05-15 21:21:03 +0800 | [diff] [blame^] | 131 |             The TCD is not packaged with the Tomcat core
 | 
 | 132 |             distribution, and must therefore be downloaded separately from
 | 
 | 133 |             the Downloads area. The download is usually labelled
 | 
 | 134 |             <i>apache-tomcat-7.0.x-deployer</i>.
 | 
| Hongqing Liu | fd5ee81 | 2014-05-10 16:32:51 +0800 | [diff] [blame] | 135 |         </p>
 | 
 | 136 |         <p>
 | 
 | 137 |             TCD has prerequisites of Apache Ant 1.6.2+ and a Java installation.
 | 
 | 138 |             Your environment should define an ANT_HOME environment value pointing to
 | 
 | 139 |             the root of your Ant installation, and a JAVA_HOME value pointing to
 | 
 | 140 |             your Java installation. Additionally, you should ensure Ant's ant
 | 
 | 141 |             command, and the Java javac compiler command run from the command shell
 | 
 | 142 |             that your operating system provides.
 | 
 | 143 |         </p>
 | 
 | 144 |         <ol>
 | 
 | 145 |             <li>Download the TCD distribution</li>
 | 
 | 146 |             <li>
 | 
 | 147 |                 The TCD package need not be extracted into any existing Tomcat
 | 
 | 148 |                 installation, it can be extracted to any location.
 | 
 | 149 |             </li>
 | 
| 刘洪青 | 6266f99 | 2017-05-15 21:21:03 +0800 | [diff] [blame^] | 150 |             <li>Read Using the <a href="#Deploying_using_the_Client_Deployer_Package">
 | 
| Hongqing Liu | fd5ee81 | 2014-05-10 16:32:51 +0800 | [diff] [blame] | 151 |             Tomcat Client Deployer</a></li>
 | 
 | 152 |         </ol>
 | 
 | 153 |     </blockquote></td></tr></table><table border="0" cellspacing="0" cellpadding="2"><tr><td bgcolor="#525D76"><font color="#ffffff" face="arial,helvetica.sanserif"><a name="A word on Contexts"><!--()--></a><a name="A_word_on_Contexts"><strong>A word on Contexts</strong></a></font></td></tr><tr><td><blockquote>
 | 
 | 154 |         <p>
 | 
 | 155 |             In talking about deployment of web applications, the concept of a
 | 
| 刘洪青 | 6266f99 | 2017-05-15 21:21:03 +0800 | [diff] [blame^] | 156 |             <i>Context</i> is required to be understood. A Context is what Tomcat
 | 
| Hongqing Liu | fd5ee81 | 2014-05-10 16:32:51 +0800 | [diff] [blame] | 157 |             calls a web application.
 | 
 | 158 |         </p>
 | 
 | 159 |         <p>
 | 
 | 160 |             In order to configure a Context within Tomcat a <i>Context Descriptor</i>
 | 
 | 161 |             is required. A Context Descriptor is simply an XML file that contains
 | 
| 刘洪青 | 6266f99 | 2017-05-15 21:21:03 +0800 | [diff] [blame^] | 162 |             Tomcat related configuration for a Context, e.g naming resources or
 | 
| Hongqing Liu | fd5ee81 | 2014-05-10 16:32:51 +0800 | [diff] [blame] | 163 |             session manager configuration. In earlier versions of
 | 
 | 164 |             Tomcat the content of a Context Descriptor configuration was often stored within
 | 
 | 165 |             Tomcat's primary configuration file <i>server.xml</i> but this is now
 | 
 | 166 |             discouraged (although it currently still works).
 | 
 | 167 |         </p>
 | 
| 刘洪青 | 6266f99 | 2017-05-15 21:21:03 +0800 | [diff] [blame^] | 168 |         <p>
 | 
 | 169 |             Context Descriptors not only help Tomcat to know how to configure
 | 
 | 170 |             Contexts but other tools such as the Tomcat Manager and TCD often use
 | 
| Hongqing Liu | fd5ee81 | 2014-05-10 16:32:51 +0800 | [diff] [blame] | 171 |             these Context Descriptors to perform their roles properly.
 | 
 | 172 |         </p>
 | 
 | 173 |         <p>
 | 
 | 174 |             The locations for Context Descriptors are:
 | 
 | 175 |         </p>
 | 
 | 176 |         <ol>
 | 
 | 177 |                 <li>$CATALINA_BASE/conf/[enginename]/[hostname]/[webappname].xml</li>
 | 
 | 178 |                 <li>$CATALINA_BASE/webapps/[webappname]/META-INF/context.xml</li>
 | 
 | 179 |         </ol>
 | 
 | 180 |         <p>
 | 
 | 181 |             Files in (1) are named [webappname].xml but files in (2) are named
 | 
 | 182 |             context.xml. If a Context Descriptor is not provided for a Context,
 | 
| 刘洪青 | 6266f99 | 2017-05-15 21:21:03 +0800 | [diff] [blame^] | 183 |             Tomcat configures the Context using default values.
 | 
| Hongqing Liu | fd5ee81 | 2014-05-10 16:32:51 +0800 | [diff] [blame] | 184 |         </p>
 | 
 | 185 |     </blockquote></td></tr></table><table border="0" cellspacing="0" cellpadding="2"><tr><td bgcolor="#525D76"><font color="#ffffff" face="arial,helvetica.sanserif"><a name="Deployment on Tomcat startup"><!--()--></a><a name="Deployment_on_Tomcat_startup"><strong>Deployment on Tomcat startup</strong></a></font></td></tr><tr><td><blockquote>
 | 
 | 186 |         <p>
 | 
| 刘洪青 | 6266f99 | 2017-05-15 21:21:03 +0800 | [diff] [blame^] | 187 |             If you are not interested in using the Tomcat Manager, or TCD,
 | 
 | 188 |             then you'll need to deploy your web applications
 | 
| Hongqing Liu | fd5ee81 | 2014-05-10 16:32:51 +0800 | [diff] [blame] | 189 |             statically to Tomcat, followed by a Tomcat startup. The location you
 | 
| 刘洪青 | 6266f99 | 2017-05-15 21:21:03 +0800 | [diff] [blame^] | 190 |             deploy web applications to for this type of deployment is called the
 | 
| Hongqing Liu | fd5ee81 | 2014-05-10 16:32:51 +0800 | [diff] [blame] | 191 |             <code>appBase</code> which is specified per Host. You either copy a
 | 
 | 192 |             so-called <i>exploded web application</i>, i.e non-compressed, to this
 | 
 | 193 |             location, or a compressed web application resource .WAR file.
 | 
 | 194 |         </p>
 | 
 | 195 |         <p>
 | 
 | 196 |             The web applications present in the location specified by the Host's
 | 
 | 197 |             (default Host is "localhost") <code>appBase</code> attribute (default
 | 
| 刘洪青 | 6266f99 | 2017-05-15 21:21:03 +0800 | [diff] [blame^] | 198 |             appBase is "$CATALINA_BASE/webapps") will be deployed on Tomcat startup
 | 
| Hongqing Liu | fd5ee81 | 2014-05-10 16:32:51 +0800 | [diff] [blame] | 199 |             only if the Host's <code>deployOnStartup</code> attribute is "true".
 | 
 | 200 |         </p>
 | 
 | 201 |         <p>
 | 
 | 202 |             The following deployment sequence will occur on Tomcat startup in that
 | 
 | 203 |             case:
 | 
 | 204 |         </p>
 | 
 | 205 |         <ol>
 | 
 | 206 |             <li>Any Context Descriptors will be deployed first.</li>
 | 
 | 207 |             <li>
 | 
 | 208 |                 Exploded web applications not referenced by any Context
 | 
| 刘洪青 | 6266f99 | 2017-05-15 21:21:03 +0800 | [diff] [blame^] | 209 |                 Descriptor will then be deployed. Note that if an exploded web
 | 
 | 210 |                 application has an associated .WAR file in the appBase, Tomcat
 | 
 | 211 |                 will not detect if the associated .WAR has been updated while
 | 
 | 212 |                 Tomcat was stopped and will deploy the exploded web application
 | 
 | 213 |                 as is. The exploded web application will not be removed and
 | 
 | 214 |                 replaced with the contents of the updated .WAR file.
 | 
| Hongqing Liu | fd5ee81 | 2014-05-10 16:32:51 +0800 | [diff] [blame] | 215 |             </li>
 | 
 | 216 |             <li>.WAR files will be deployed</li>
 | 
 | 217 |         </ol>
 | 
| Hongqing Liu | fd5ee81 | 2014-05-10 16:32:51 +0800 | [diff] [blame] | 218 |     </blockquote></td></tr></table><table border="0" cellspacing="0" cellpadding="2"><tr><td bgcolor="#525D76"><font color="#ffffff" face="arial,helvetica.sanserif"><a name="Deploying on a running Tomcat server"><!--()--></a><a name="Deploying_on_a_running_Tomcat_server"><strong>Deploying on a running Tomcat server</strong></a></font></td></tr><tr><td><blockquote>
 | 
 | 219 |         <p>
 | 
 | 220 |             It is possible to deploy web applications to a running Tomcat server.
 | 
 | 221 |         </p>
 | 
 | 222 |         <p>
 | 
| 刘洪青 | 6266f99 | 2017-05-15 21:21:03 +0800 | [diff] [blame^] | 223 |             If the Host <code>autoDeploy</code> attribute is "true", the Host will
 | 
| Hongqing Liu | fd5ee81 | 2014-05-10 16:32:51 +0800 | [diff] [blame] | 224 |             attempt to deploy and update web applications dynamically, as needed,
 | 
| 刘洪青 | 6266f99 | 2017-05-15 21:21:03 +0800 | [diff] [blame^] | 225 |             for example if a new .WAR is dropped into the <code>appBase</code>.
 | 
 | 226 |             For this to work, the Host needs to have background processing
 | 
| Hongqing Liu | fd5ee81 | 2014-05-10 16:32:51 +0800 | [diff] [blame] | 227 |             enabled which is the default configuration.
 | 
 | 228 |         </p>
 | 
| 刘洪青 | 6266f99 | 2017-05-15 21:21:03 +0800 | [diff] [blame^] | 229 | 
 | 
| Hongqing Liu | fd5ee81 | 2014-05-10 16:32:51 +0800 | [diff] [blame] | 230 |         <p>
 | 
 | 231 |             <code>autoDeploy</code> set to "true" and a running Tomcat allows for:
 | 
 | 232 |         </p>
 | 
 | 233 |         <ul>
 | 
 | 234 |             <li>Deployment of .WAR files copied into the Host <code>appBase</code>.</li>
 | 
 | 235 |             <li>
 | 
 | 236 |                 Deployment of exploded web applications which are
 | 
 | 237 |                 copied into the Host <code>appBase</code>.
 | 
 | 238 |             </li>
 | 
 | 239 |             <li>
 | 
 | 240 |                 Re-deployment of a web application which has already been deployed from
 | 
| 刘洪青 | 6266f99 | 2017-05-15 21:21:03 +0800 | [diff] [blame^] | 241 |                 a .WAR when the new .WAR is provided. In this case the exploded
 | 
 | 242 |                 web application is removed, and the .WAR is expanded again.
 | 
 | 243 |                 Note that the explosion will not occur if the Host is configured
 | 
| Hongqing Liu | fd5ee81 | 2014-05-10 16:32:51 +0800 | [diff] [blame] | 244 |                 so that .WARs are not exploded with a <code>unpackWARs</code>
 | 
| 刘洪青 | 6266f99 | 2017-05-15 21:21:03 +0800 | [diff] [blame^] | 245 |                 attribute set to "false", in which case the web application
 | 
| Hongqing Liu | fd5ee81 | 2014-05-10 16:32:51 +0800 | [diff] [blame] | 246 |                 will be simply redeployed as a compressed archive.
 | 
 | 247 |             </li>
 | 
 | 248 |             <li>
 | 
| 刘洪青 | 6266f99 | 2017-05-15 21:21:03 +0800 | [diff] [blame^] | 249 |                 Re-loading of a web application if the /WEB-INF/web.xml file (or
 | 
 | 250 |                 any other resource defined as a WatchedResource) is updated.
 | 
| Hongqing Liu | fd5ee81 | 2014-05-10 16:32:51 +0800 | [diff] [blame] | 251 |             </li>
 | 
 | 252 |             <li>
 | 
| 刘洪青 | 6266f99 | 2017-05-15 21:21:03 +0800 | [diff] [blame^] | 253 |                 Re-deployment of a web application if the Context Descriptor
 | 
 | 254 |                 file from which the web application has been deployed is
 | 
 | 255 |                 updated.
 | 
 | 256 |             </li>
 | 
 | 257 |             <li>
 | 
 | 258 |                 Re-deployment of dependent web applications if the global or
 | 
 | 259 |                 per-host Context Descriptor file used by the web application is
 | 
 | 260 |                 updated.
 | 
| Hongqing Liu | fd5ee81 | 2014-05-10 16:32:51 +0800 | [diff] [blame] | 261 |             </li>
 | 
 | 262 |             <li>
 | 
 | 263 |                 Re-deployment of a web application if a Context Descriptor file (with a
 | 
 | 264 |                 filename corresponding to the Context path of the previously deployed
 | 
| 刘洪青 | 6266f99 | 2017-05-15 21:21:03 +0800 | [diff] [blame^] | 265 |                 web application) is added to the
 | 
| Hongqing Liu | fd5ee81 | 2014-05-10 16:32:51 +0800 | [diff] [blame] | 266 |                 <code>$CATALINA_BASE/conf/[enginename]/[hostname]/</code>
 | 
 | 267 |                 directory.
 | 
 | 268 |             </li>
 | 
 | 269 |             <li>
 | 
 | 270 |                 Undeployment of a web application if its document base (docBase)
 | 
| 刘洪青 | 6266f99 | 2017-05-15 21:21:03 +0800 | [diff] [blame^] | 271 |                 is deleted. Note that on Windows, this assumes that anti-locking
 | 
 | 272 |                 features (see Context configuration) are enabled, otherwise it is not
 | 
| Hongqing Liu | fd5ee81 | 2014-05-10 16:32:51 +0800 | [diff] [blame] | 273 |                 possible to delete the resources of a running web application.
 | 
 | 274 |             </li>
 | 
 | 275 |         </ul>
 | 
 | 276 |         <p>
 | 
 | 277 |             Note that web application reloading can also be configured in the loader, in which
 | 
 | 278 |             case loaded classes will be tracked for changes.
 | 
 | 279 |         </p>
 | 
 | 280 |     </blockquote></td></tr></table><table border="0" cellspacing="0" cellpadding="2"><tr><td bgcolor="#525D76"><font color="#ffffff" face="arial,helvetica.sanserif"><a name="Deploying using the Tomcat Manager"><!--()--></a><a name="Deploying_using_the_Tomcat_Manager"><strong>Deploying using the Tomcat Manager</strong></a></font></td></tr><tr><td><blockquote>
 | 
 | 281 |         <p>
 | 
| 刘洪青 | 6266f99 | 2017-05-15 21:21:03 +0800 | [diff] [blame^] | 282 |             The Tomcat Manager is covered in its <a href="manager-howto.html">own manual page</a>.
 | 
| Hongqing Liu | fd5ee81 | 2014-05-10 16:32:51 +0800 | [diff] [blame] | 283 |         </p>
 | 
 | 284 |     </blockquote></td></tr></table><table border="0" cellspacing="0" cellpadding="2"><tr><td bgcolor="#525D76"><font color="#ffffff" face="arial,helvetica.sanserif"><a name="Deploying using the Client Deployer Package"><!--()--></a><a name="Deploying_using_the_Client_Deployer_Package"><strong>Deploying using the Client Deployer Package</strong></a></font></td></tr><tr><td><blockquote>
 | 
 | 285 |         <p>
 | 
| 刘洪青 | 6266f99 | 2017-05-15 21:21:03 +0800 | [diff] [blame^] | 286 |             Finally, deployment of web application may be achieved using the
 | 
 | 287 |             Tomcat Client Deployer. This is a package which can be used to
 | 
 | 288 |             validate, compile, compress to .WAR, and deploy web applications to
 | 
 | 289 |             production or development Tomcat servers. It should be noted that this feature
 | 
| Hongqing Liu | fd5ee81 | 2014-05-10 16:32:51 +0800 | [diff] [blame] | 290 |             uses the Tomcat Manager and as such the target Tomcat server should be
 | 
 | 291 |             running.
 | 
 | 292 |         </p>
 | 
| 刘洪青 | 6266f99 | 2017-05-15 21:21:03 +0800 | [diff] [blame^] | 293 | 
 | 
| Hongqing Liu | fd5ee81 | 2014-05-10 16:32:51 +0800 | [diff] [blame] | 294 |         <p>
 | 
 | 295 |             It is assumed the user will be familiar with Apache Ant for using the TCD.
 | 
 | 296 |             Apache Ant is a scripted build tool. The TCD comes pre-packaged with a
 | 
 | 297 |             build script to use. Only a modest understanding of Apache Ant is
 | 
 | 298 |             required (installation as listed earlier in this page, and familiarity
 | 
 | 299 |             with using the operating system command shell and configuring
 | 
 | 300 |             environment variables).
 | 
 | 301 |         </p>
 | 
| 刘洪青 | 6266f99 | 2017-05-15 21:21:03 +0800 | [diff] [blame^] | 302 | 
 | 
| Hongqing Liu | fd5ee81 | 2014-05-10 16:32:51 +0800 | [diff] [blame] | 303 |         <p>
 | 
| 刘洪青 | 6266f99 | 2017-05-15 21:21:03 +0800 | [diff] [blame^] | 304 |             The TCD includes Ant tasks, the Jasper page compiler for JSP compilation
 | 
| Hongqing Liu | fd5ee81 | 2014-05-10 16:32:51 +0800 | [diff] [blame] | 305 |             before deployment, as well as a task which
 | 
 | 306 |             validates the web application Context Descriptor. The validator task (class
 | 
 | 307 |             <code>org.apache.catalina.ant.ValidatorTask</code>) allows only one parameter:
 | 
 | 308 |             the base path of an exploded web application.
 | 
 | 309 |         </p>
 | 
| 刘洪青 | 6266f99 | 2017-05-15 21:21:03 +0800 | [diff] [blame^] | 310 | 
 | 
| Hongqing Liu | fd5ee81 | 2014-05-10 16:32:51 +0800 | [diff] [blame] | 311 |         <p>
 | 
 | 312 |             The TCD uses an exploded web application as input (see the list of the
 | 
| 刘洪青 | 6266f99 | 2017-05-15 21:21:03 +0800 | [diff] [blame^] | 313 |             properties used below). A web application that is programmatically
 | 
 | 314 |             deployed with the deployer may include a Context Descriptor in
 | 
| Hongqing Liu | fd5ee81 | 2014-05-10 16:32:51 +0800 | [diff] [blame] | 315 |             <code>/META-INF/context.xml</code>.
 | 
 | 316 |         </p>
 | 
| 刘洪青 | 6266f99 | 2017-05-15 21:21:03 +0800 | [diff] [blame^] | 317 | 
 | 
| Hongqing Liu | fd5ee81 | 2014-05-10 16:32:51 +0800 | [diff] [blame] | 318 |         <p>
 | 
 | 319 |             The TCD includes a ready-to-use Ant script, with the following targets:
 | 
 | 320 |         </p>
 | 
 | 321 |         <ul>
 | 
 | 322 |             <li>
 | 
| 刘洪青 | 6266f99 | 2017-05-15 21:21:03 +0800 | [diff] [blame^] | 323 |                 <code>compile</code> (default): Compile and validate the web
 | 
| Hongqing Liu | fd5ee81 | 2014-05-10 16:32:51 +0800 | [diff] [blame] | 324 |                 application. This can be used standalone, and does not need a running
 | 
 | 325 |                 Tomcat server. The compiled application will only run on the associated
 | 
| 刘洪青 | 6266f99 | 2017-05-15 21:21:03 +0800 | [diff] [blame^] | 326 |                 <em>Tomcat X.Y.Z</em> server release, and is not guaranteed to work
 | 
 | 327 |                 on another Tomcat release, as the code generated by Jasper depends on its runtime
 | 
| Hongqing Liu | fd5ee81 | 2014-05-10 16:32:51 +0800 | [diff] [blame] | 328 |                 component. It should also be noted that this target will also compile
 | 
| 刘洪青 | 6266f99 | 2017-05-15 21:21:03 +0800 | [diff] [blame^] | 329 |                 automatically any Java source file located in the
 | 
| Hongqing Liu | fd5ee81 | 2014-05-10 16:32:51 +0800 | [diff] [blame] | 330 |                 <code>/WEB-INF/classes</code> folder of the web application.</li>
 | 
 | 331 |             <li>
 | 
| 刘洪青 | 6266f99 | 2017-05-15 21:21:03 +0800 | [diff] [blame^] | 332 |                 <code>deploy</code>: Deploy a web application (compiled or not) to
 | 
| Hongqing Liu | fd5ee81 | 2014-05-10 16:32:51 +0800 | [diff] [blame] | 333 |                 a Tomcat server.
 | 
 | 334 |             </li>
 | 
 | 335 |             <li><code>undeploy</code>: Undeploy a web application</li>
 | 
 | 336 |             <li><code>start</code>: Start web application</li>
 | 
 | 337 |             <li><code>reload</code>: Reload web application</li>
 | 
 | 338 |             <li><code>stop</code>: Stop web application</li>
 | 
 | 339 |         </ul>
 | 
| 刘洪青 | 6266f99 | 2017-05-15 21:21:03 +0800 | [diff] [blame^] | 340 | 
 | 
| Hongqing Liu | fd5ee81 | 2014-05-10 16:32:51 +0800 | [diff] [blame] | 341 |         <p>
 | 
 | 342 |             In order for the deployment to be configured, create a file
 | 
 | 343 |             called <code>deployer.properties</code> in the TCD installation
 | 
 | 344 |             directory root. In this file, add the following name=value pairs per
 | 
 | 345 |             line:
 | 
 | 346 |         </p>
 | 
| 刘洪青 | 6266f99 | 2017-05-15 21:21:03 +0800 | [diff] [blame^] | 347 | 
 | 
| Hongqing Liu | fd5ee81 | 2014-05-10 16:32:51 +0800 | [diff] [blame] | 348 |         <p>
 | 
| 刘洪青 | 6266f99 | 2017-05-15 21:21:03 +0800 | [diff] [blame^] | 349 |             Additionally, you will need to ensure that a user has been
 | 
| Hongqing Liu | fd5ee81 | 2014-05-10 16:32:51 +0800 | [diff] [blame] | 350 |             setup for the target Tomcat Manager (which TCD uses) otherwise the TCD
 | 
 | 351 |             will not authenticate with the Tomcat Manager and the deployment will
 | 
| 刘洪青 | 6266f99 | 2017-05-15 21:21:03 +0800 | [diff] [blame^] | 352 |             fail. To do this, see the Tomcat Manager page.
 | 
| Hongqing Liu | fd5ee81 | 2014-05-10 16:32:51 +0800 | [diff] [blame] | 353 |         </p>
 | 
| 刘洪青 | 6266f99 | 2017-05-15 21:21:03 +0800 | [diff] [blame^] | 354 | 
 | 
| Hongqing Liu | fd5ee81 | 2014-05-10 16:32:51 +0800 | [diff] [blame] | 355 |         <ul>
 | 
 | 356 |             <li>
 | 
| 刘洪青 | 6266f99 | 2017-05-15 21:21:03 +0800 | [diff] [blame^] | 357 |                 <code>build</code>: The build folder used will be, by default,
 | 
 | 358 |                 <code>${build}/webapp/${path}</code> (<code>${build}</code>, by
 | 
 | 359 |                 default, points to <code>${basedir}/build</code>). After the end
 | 
 | 360 |                 of the execution of the <code>compile</code> target, the web
 | 
 | 361 |                 application .WAR will be located at
 | 
 | 362 |                 <code>${build}/webapp/${path}.war</code>.
 | 
| Hongqing Liu | fd5ee81 | 2014-05-10 16:32:51 +0800 | [diff] [blame] | 363 |             </li>
 | 
 | 364 |             <li>
 | 
| 刘洪青 | 6266f99 | 2017-05-15 21:21:03 +0800 | [diff] [blame^] | 365 |                 <code>webapp</code>: The directory containing the exploded web application
 | 
| Hongqing Liu | fd5ee81 | 2014-05-10 16:32:51 +0800 | [diff] [blame] | 366 |                 which will be compiled and validated. By default, the folder is
 | 
 | 367 |                 <code>myapp</code>.
 | 
 | 368 |             </li>
 | 
 | 369 |             <li>
 | 
| 刘洪青 | 6266f99 | 2017-05-15 21:21:03 +0800 | [diff] [blame^] | 370 |                 <code>path</code>: Deployed context path of the web application,
 | 
| Hongqing Liu | fd5ee81 | 2014-05-10 16:32:51 +0800 | [diff] [blame] | 371 |                 by default <code>/myapp</code>.
 | 
 | 372 |             </li>
 | 
 | 373 |             <li>
 | 
| 刘洪青 | 6266f99 | 2017-05-15 21:21:03 +0800 | [diff] [blame^] | 374 |                 <code>url</code>: Absolute URL to the Tomcat Manager web application of a
 | 
| Hongqing Liu | fd5ee81 | 2014-05-10 16:32:51 +0800 | [diff] [blame] | 375 |                 running Tomcat server, which will be used to deploy and undeploy the
 | 
| 刘洪青 | 6266f99 | 2017-05-15 21:21:03 +0800 | [diff] [blame^] | 376 |                 web application. By default, the deployer will attempt to access
 | 
 | 377 |                 a Tomcat instance running on localhost, at
 | 
 | 378 |                 <code>http://localhost:8080/manager/text</code>.
 | 
| Hongqing Liu | fd5ee81 | 2014-05-10 16:32:51 +0800 | [diff] [blame] | 379 |             </li>
 | 
 | 380 |             <li>
 | 
 | 381 |                 <code>username</code>: Tomcat Manager username (user should have a role of
 | 
 | 382 |                 manager-script)
 | 
 | 383 |             </li>
 | 
 | 384 |             <li><code>password</code>: Tomcat Manager password.</li>
 | 
 | 385 |         </ul>
 | 
| 刘洪青 | 6266f99 | 2017-05-15 21:21:03 +0800 | [diff] [blame^] | 386 |     </blockquote></td></tr></table></td></tr><tr class="noPrint"><td width="20%" valign="top" nowrap class="noPrint"></td><td width="80%" valign="top" align="left"><table border="0" cellspacing="0" cellpadding="2"><tr><td bgcolor="#525D76"><font color="#ffffff" face="arial,helvetica.sanserif"><a name="comments_section" id="comments_section"><strong>Comments</strong></a></font></td></tr><tr><td><blockquote><p class="notice"><strong>Notice: </strong>This comments section collects your suggestions
 | 
 | 387 |               on improving documentation for Apache Tomcat.<br><br>
 | 
 | 388 |               If you have trouble and need help, read
 | 
 | 389 |               <a href="http://tomcat.apache.org/findhelp.html">Find Help</a> page
 | 
 | 390 |               and ask your question on the tomcat-users
 | 
 | 391 |               <a href="http://tomcat.apache.org/lists.html">mailing list</a>.
 | 
 | 392 |               Do not ask such questions here. This is not a Q&A section.<br><br>
 | 
 | 393 |               The Apache Comments System is explained <a href="./comments.html">here</a>.
 | 
 | 394 |               Comments may be removed by our moderators if they are either
 | 
 | 395 |               implemented or considered invalid/off-topic.</p><script type="text/javascript"><!--//--><![CDATA[//><!--
 | 
 | 396 |               var comments_shortname = 'tomcat';
 | 
 | 397 |               var comments_identifier = 'http://tomcat.apache.org/tomcat-7.0-doc/deployer-howto.html';
 | 
 | 398 |               (function(w, d) {
 | 
 | 399 |                   if (w.location.hostname.toLowerCase() == "tomcat.apache.org") {
 | 
 | 400 |                       d.write('<div id="comments_thread"><\/div>');
 | 
 | 401 |                       var s = d.createElement('script');
 | 
 | 402 |                       s.type = 'text/javascript';
 | 
 | 403 |                       s.async = true;
 | 
 | 404 |                       s.src = 'https://comments.apache.org/show_comments.lua?site=' + comments_shortname + '&page=' + comments_identifier;
 | 
 | 405 |                       (d.getElementsByTagName('head')[0] || d.getElementsByTagName('body')[0]).appendChild(s);
 | 
 | 406 |                   }
 | 
 | 407 |                   else {
 | 
 | 408 |                       d.write('<div id="comments_thread"><strong>Comments are disabled for this page at the moment.<\/strong><\/div>');
 | 
 | 409 |                   }
 | 
 | 410 |               })(window, document);
 | 
 | 411 |               //--><!]]></script></blockquote></td></tr></table></td></tr><!--FOOTER SEPARATOR--><tr><td colspan="2"><hr noshade size="1"></td></tr><!--PAGE FOOTER--><tr><td colspan="2"><div align="center"><font color="#525D76" size="-1"><em>
 | 
 | 412 |         Copyright © 1999-2017, Apache Software Foundation
 | 
| Hongqing Liu | fd5ee81 | 2014-05-10 16:32:51 +0800 | [diff] [blame] | 413 |         </em></font></div></td></tr></table></body></html> |