Tomcat翻译--Tomcat Web Application Deployment(Tomcat中部署web应用)
原文:http://tomcat.apache.org/tomcat-7.0-doc/deployer-howto.html
Introduction(介绍)
Deployment is the term used for the process of installing a web application (either a 3rd party WAR or your own custom web application) into the Tomcat server.
【“部署”是用来表示在Tomcat服务器上安装一个web应用(或者第三方war包以及你自定义的web应用)的术语。】
Web application deployment may be accomplished in a number of ways within the Tomcat server.
【部署web应用在tomcat中有多种实现方式。】
Statically; the web application is setup before Tomcat is started
Dynamically; by directly manipulating already deployed web applications (relying on auto-deployment feature) or remotely by using the Tomcat Manager web application
The Tomcat Manager is a web application that can be used interactively (via HTML GUI) or programmatically (via URL-based API) to deploy and manage web applications.
【静态部署:在tomcat启动之前就安装好的web应用;】
【动态部署:通过直接操作或者通过tomcat manager远程操作已经部署好的web应用(依赖自动部署特性)。】
【tomcat manager本身就是一个web应用,你可以使用它来交互式或者编程式地管理你的web应用。】
There are a number of ways to perform deployment that rely on the Manager web application. Apache Tomcat provides tasks for Apache Ant build tool. Apache Tomcat Maven Plugin project provides integration with Apache Maven. There is also a tool called the Client Deployer, which can be used from a command line and provides additional functionality such as compiling and validating web applications as well as packaging web application into web application resource (WAR) files.
【你可以使用Manager应用,通过多种方式进行部署。Apache Tomcat提供了Apache Ant构建工具来执行部署;Apache Tomcat Maven Plugin提供了与Maven的集成;还有一个名为Client Deployer的工具,你可以通过命令行来使用,这个工具还提供了一些额外的功能,比如编译、验证、打包等。】
Installation(安装)
There is no installation required for static deployment of web applications as this is provided out of the box by Tomcat. Nor is any installation required for deployment functions with the Tomcat Manager, although some configuration is required as detailed in the Tomcat Manager manual. An installation is however required if you wish to use the Tomcat Client Deployer (TCD).
The TCD is not packaged with the Tomcat core distribution, and must therefore be downloaded separately from the Downloads area. The download is usually labelled apache-tomcat-7.0.x-deployer.
【静态部署web应用时,不需要在tomcat中安装任何东西,因为这是tomcat本身就提供的功能;也不需要在tomcat manager中安装任何东西,尽管tomcat manager的操作手册中提到了会需要一些配置。但如果你想使用tomcat client deployer(TCD)的话,则需要进行安装。tomcat核心发行版中没有包含TCD,因此你需要单独下载,下载链接一般会被标记为”apache-tomcat-7.0.x-deployer“。】
TCD has prerequisites of Apache Ant 1.6.2+ and a Java installation. Your environment should define an ANT_HOME environment value pointing to the root of your Ant installation, and a JAVA_HOME value pointing to your Java installation. Additionally, you should ensure Ant's ant command, and the Java javac compiler command run from the command shell that your operating system provides.
【TCD需要预装Apache Ant 1.6.2+和Java。你的环境变量中需要定义一个ANT_HOME环境变量,指向Ant的安装目录,以及一个JAVA_HOME环境变量,指向Java的安装目录。除此之外,还需要保证ant命令和javac命令可以在你的操作系统的命令行中正常运行。】
Download the TCD distribution【下载TCD发行版】
The TCD package need not be extracted into any existing Tomcat installation, it can be extracted to any location.
Read Using the Tomcat Client Deployer
【TCD包可以被解压到任何位置,而不需要被解压到Tomcat的安装目录中。你可以参考“Tomcat Client Deployer的使用”这一小节。]
A word on Contexts(Context概述)
In talking about deployment of web applications, the concept of a Context is required to be understood. A Context is what Tomcat calls a web application.
【在讨论web应用的部署之前,首先了解以下Context的含义。在tomcat中,一个Context就表示一个web应用。】
In order to configure a Context within Tomcat a Context Descriptor is required. A Context Descriptor is simply an XML file that contains Tomcat related configuration for a Context, e.g naming resources or session manager configuration. In earlier versions of Tomcat the content of a Context Descriptor configuration was often stored within Tomcat's primary configuration file server.xml but this is now discouraged (although it currently still works).
Context Descriptors not only help Tomcat to know how to configure Contexts but other tools such as the Tomcat Manager and TCD often use these Context Descriptors to perform their roles properly.
【在Tomcat中配置一个Context,需要一个Context Descriptor。Context Descriptor是一个包含Context的相关配置的XML文件,比如资源标识或者会话管理器配置。在早先的Tomcat版本中,Context Descriptor配置经常被放在server.xml文件中,但现在已经不鼓励这么做(尽管依然可以这么做)。】
【Context Descriptor不仅帮助Tomcat了解怎样配置Context,而且其他的一些工具,比如Tomcat Manager以及TCD,也经常使用这些Context Descriptor来执行它们的功能。】
The locations for Context Descriptors are:
1.$CATALINA_BASE/conf/[enginename]/[hostname]/[webappname].xml
2.$CATALINA_BASE/webapps/[webappname]/META-INF/context.xml
Files in (1) are named [webappname].xml but files in (2) are named context.xml. If a Context Descriptor is not provided for a Context, Tomcat configures the Context using default values.
【Context Descriptor存放的位置如下:】
【1.$CATALINA_BASE/conf/[enginename]/[hostname]/[webappname].xml】
【2..$CATALINA_BASE/webapps/[webappname]/META-INF/context.xml】
【(1)中的文件名是[webappname].xml,(2)中的文件名是context.xml。如果一个Context没有提供Context Descriptor,则Tomcat会为用缺省值配置Context。】
Deployment on Tomcat startup【在Tomcat启动时部署】
If you are not interested in using the Tomcat Manager, or TCD, then you'll need to deploy your web applications statically to Tomcat, followed by a Tomcat startup. The location you deploy web applications to for this type of deployment is called the appBase which is specified per Host. You either copy a so-called exploded web application, i.e non-compressed, to this location, or a compressed web application resource .WAR file.
The web applications present in the location specified by the Host's (default Host is "localhost") appBase attribute (default appBase is "$CATALINA_BASE/webapps") will be deployed on Tomcat startup only if the Host's deployOnStartup attribute is "true".
【如果不想使用Tomcat Manager或者TCD,那么可以将web应用静态部署到tomcat上,接着再启动tomcat。对于每一个指定的Host,web应用应该被部署在appBase目录下,你可以在appBase目录下部署未解压的.war文件或者解压后的web应用。】
【当Host的deployOnStartup属性为true时,位于Host(缺省值为“localhost”)中的appBase属性(缺省值为"$CATALINA_BASE/webapps")下的web应用将随tomcat的启动而被自动部署。]
The following deployment sequence will occur on Tomcat startup in that case:
Any Context Descriptors will be deployed first.
Exploded web applications not referenced by any Context Descriptor will then be deployed. Note that if an exploded web application has an associated .WAR file in the appBase, Tomcat will not detect if the associated .WAR has been updated while Tomcat was stopped and will deploy the exploded web application as is. The exploded web application will not be removed and replaced with the contents of the updated .WAR file.
.WAR files will be deployed
【tomcat启动时,部署按照以下步骤顺序执行:】
【首先部署的是Context Descriptor。然后部署Context Descriptor中没有涉及到的已解压的web应用。注意,如果一个已解压的web应用在appBase下有一个相对应的.war文件,则tomcat不会检测自从上次关闭后,该.war文件是否被更新,而只是部署该解压后的web应用。解压后的web应用不会被移除,也不会被更新后的.war文件的内容替换。最后被部署的是.war文件。】
总结:tomcat启动时部署顺序如下:
1.部署$CATALINA_BASE/conf/[enginename]/[hostname]/[webappname].xml以及$CATALINE_BASE/webapps/[webappname]/META-INF/context.xml;
2.部署appBase下已经被解压的web应用;
3.部署appBase下的.war文件。
注:
(1)部署appBase下的已解压web应用以及.war文件,指的是appBase/这一级目录,不包括其他的子目录,也就是说,除了appBase/这一级目录下的web应用以及.war文件会被自动部署之外,其他的web应用以及.war文件不会被自动部署(.war文件也不会被自动解压)
(2)静态部署时,如果存在一个已解压的web应用,以及一个同名的未解压的web应用,则tomcat不会检测到自动上次关闭后,该.war文件是否被更新,而只会部署解压后的web应用,不会部署.war文件。只有在tomat启动后,当.war文件被修改后,才会更新相应的解压的web应用,即热部署。
Deploying on a running Tomcat server(在tomcat运行时部署,即热部署)
It is possible to deploy web applications to a running Tomcat server.
If the Host autoDeploy attribute is "true", the Host will attempt to deploy and update web applications dynamically, as needed, for example if a new .WAR is dropped into the appBase. For this to work, the Host needs to have background processing enabled which is the default configuration.
【在tomcat运行时也可以部署web应用。】
【如果主机的autoDeploy属性被设置为true,那么该主机在需要时会尝试动态部署及更新web应用。比如,如果一个appBase中添加了一个新的.war文件,则该主机就会动态解压并部署该web应用。为了实现这个目的,主机必须有一个具有默认配置的后台进程】
autoDeploy set to "true" and a running Tomcat allows for:
Deployment of .WAR files copied into the Host appBase.
Deployment of exploded web applications which are copied into the Host appBase.
Re-deployment of a web application which has already been deployed from a .WAR when the new .WAR is provided. In this case the exploded web application is removed, and the .WAR is expanded again. Note that the explosion will not occur if the Host is configured so that .WARs are not exploded with a unpackWARs attribute set to "false", in which case the web application will be simply redeployed as a compressed archive.
Re-loading of a web application if the /WEB-INF/web.xml file (or any other resource defined as a WatchedResource) is updated.
Re-deployment of a web application if the Context Descriptor file from which the web application has been deployed is updated.
Re-deployment of dependent web applications if the global or per-host Context Descriptor file used by the web application is updated.
Re-deployment of a web application if a Context Descriptor file (with a filename corresponding to the Context path of the previously deployed web application) is added to the $CATALINA_BASE/conf/[enginename]/[hostname]/ directory.
Undeployment of a web application if its document base (docBase) is deleted. Note that on Windows, this assumes that anti-locking features (see Context configuration) are enabled, otherwise it is not possible to delete the resources of a running web application.
【autoDeploy设为true,允许tomcat在运行时执行以下操作:】
【部署放到appBase下的.war文件;】
【部署放到appBase下的解压的web应用;】
【如果解压的web应用在appBase目录下还有一个相对应的.war文件,且该.war文件被更新了,此时,原先的web应用被移除,更新后的.war文件会被再次解压并部署。需要注意的是,如果unpackWars属性被设置为false,则不会像前面所说的那样对.war文件进行解压并部署;】
【如果/WEB-INF/web.xml文件或者任何被WatchedResource元素指定的资源发生更新,则对应的web应用会被重新部署;】
【如果Context Descriptor文件中描述的web应用被更新了,则重新部署该web应用;】
【如果web应用使用的全局或者per-host的Context Descriptor文件被更新,则该web应用会被重新部署;】
【如果在$CATALINA_BASE/conf/[enginename]/[hostname]/目录下增加了一个Context Descriptor文件(文件名与先前部署的web应用的Context path相同),则该web应用被重新部署;】
【如果一个web应用的docBase被删除,则该web应用被卸载。注意,在windows下,该特性假设anti-locking特性已被设置,否则不允许删除运行中的web应用的资源;】
Tomcat翻译--Tomcat Web Application Deployment(Tomcat中部署web应用)的更多相关文章
- 在Tomcat中部署Web项目的操作方法,maven项目在Tomcat里登录首页报404
maven项目在Tomcat里登录首页报404, 解决:编辑conf/server.xml进行配置<Host>里的<Context>标签里的path. <Context ...
- 在Tomcat中部署web项目的三种方式
搬瓦工搭建SS教程 SSR免费节点:http://www.xiaokeli.me 在这里介绍在Tomcat中部署web项目的三种方式: 1.部署解包的webapp目录 2.打包的war文件 3.Man ...
- Tomcat中部署web应用的三种方式
Tomcat中部署web应用的三种方式(静态部署) 第一种,针对war或解压后的war,最为常用的是直接操作webapp目录,将完整的war包或者web应用直接放到webapp目录下.使用 ...
- Tomcat 中部署 web 应用 ---- Dubbo 服务消费者 Web 应用 war 包的部署
使用Maven构建Dubbo服务的可执行jar包 Dubbo服务的运行方式: 1.使用Servlet容器运行(Tomcat.Jetty等)----不可取 缺点:增加复杂性(端口.管理) 浪费资源(内存 ...
- The "web.xml" is called web application deployment descriptor
3.3 Configure the Application Deployment Descriptor - "web.xml" A web user invokes a serv ...
- 返璞归真 asp.net mvc (11) - asp.net mvc 4.0 新特性之自宿主 Web API, 在 WebForm 中提供 Web API, 通过 Web API 上传文件, .net 4.5 带来的更方便的异步操作
原文:返璞归真 asp.net mvc (11) - asp.net mvc 4.0 新特性之自宿主 Web API, 在 WebForm 中提供 Web API, 通过 Web API 上传文件, ...
- Tomcat:Custom a common error page valve for all web application in tomcat
如果在一个Tomcat Server上会部署多个Web应用,又希望这多个Web应用共用一套错误页面,而不是使用默认的错误页面.就需要自定义错误页面了. 在每个web应用中都可以通过error-page ...
- Tomcat中部署WEB项目的四种方法
对Tomcat部署web应用的方式总结,常见的有以下四种: 1.[使用控制台部署] 访问Http://localhost:8080,并通过Tomcat Manager登录,进入部署界面即可. 2.[利 ...
- Tomcat中部署web应用 ---- Dubbo服务消费者Web应用war包的部署
样例视频:http://www.roncoo.com/course/view/f614343765bc4aac8597c6d8b38f06fd IP: 192.168.2.61 部署容器:apache ...
随机推荐
- ipmi 最新和MegaCli 监控磁盘和raid信息
集群监控之 —— ipmi操作指南 原创 2010年03月23日 16:45:00 标签: 集群 / 服务器 / command / callback / user / interface 12224 ...
- 各种类型的电影排行榜-movie路线
[最费脑力的14部电影]<盗梦空间>.<记忆裂痕>.<生死停留>.<死亡幻觉>.<禁闭岛>.<穆赫兰道>.<蝴蝶效应> ...
- PHP 学习内容
第一阶段: (PHP+MySQL核心编程) 面向对象编程 MySQL数据库, MySQL的优化细节. HTTP协议,http也是我们web开发的基石.对我们了解PHP底层机制有很大帮助,做到知其然,还 ...
- Xampp 环境问题集合
1.不小心把虚拟机的环境删了,需要重新安装xmapp 安装很简单,但是重启:/opt/lampp/lampp restart 发现 XAMPP:"Another web server dae ...
- ios 手势返回<1>2
iOS-给push出来的控制器添加全局滑动(返回)手势 在iOS中,当我们push出一个新的控制器的时候,我们可以向右拖拽屏幕的左边缘来返回(pop)到上一级控制器,但是这个功能有两个缺陷: 当自 ...
- PHP-Manual的学习----【语言参考】----【类型】-----【NULL】
2017年8月24日11:34:061.特殊的 NULL 值表示一个变量没有值.NULL 类型唯一可能的值就是 NULL. 2.在下列情况下一个变量被认为是 NULL: ◦ 被赋值为 NULL. ◦ ...
- POJ 1694 An Old Stone Game【递归+排序】
链接: http://poj.org/problem?id=1694 http://acm.hust.edu.cn/vjudge/contest/view.action?cid=27454#probl ...
- iOS NSError HTTP错误码大全
NSError codes in the Cocoa error domain. enum { NSFileNoSuchFileError = 4, NSFileLockingError = 255, ...
- java面试之数据库面试知识点【转】
1. 主键 超键 候选键 外键 主 键: 数据库表中对储存数据对象予以唯一和完整标识的数据列或属性的组合.一个数据列只能有一个主键,且主键的取值不能缺失,即不能为空值(Null). 超 键: 在关系中 ...
- (转)Javascript模块化编程(二):AMD规范
这个系列的第一部分介绍了Javascript模块的基本写法,今天介绍如何规范地使用模块. (接上文) 七.模块的规范 先想一想,为什么模块很重要? 因为有了模块,我们就可以更方便地使用别人的代码,想要 ...