<!--RIGHT SIDE MAIN BODY-->
The Apache Jakarta Tomcat 5.5 Servlet/JSP Container
Manager App HOW-TO/帮助文档
|
|
Table of Contents/内容列表
|
Introduction/介绍 Configuring Manager Application Access/配置管理应用程序权限 Supported Manager Commands/支持的管理命令
Deploy A New Application Remotely/远程打包应用程序 Deploy A New Application from a Local Path/从本地路径打包应用程序 List Currently Deployed Applications/列表最近打包的应用程序 Reload An Existing Application/重载已经存在的应用程序 List OS and JVM Properties/操作系统与JAVA虚拟机属性列表 List Available Global JNDI Resources/全局JNDI资源变量列表 List Available Security Roles/安全角色变量列表 Session Statistics/Session统计 Start an Existing Application/启动存在的应用程序 Stop an Existing Application/停止应用程序 Undeploy an Existing Application/应用程序解包
Executing Manager Commands With Ant/用Ant执行管理命令 Using the JMX Proxy Servlet/使用JMX代理Servlet
What is JMX Proxy Servlet?/什么是JMX代理Servlet? Query command/查询命令 Set command/命令设置
|
Introduction/介绍
|
In many production environments, it is very useful to have the capability to deploy a new web application, or undeploy an existing one, without having to shut down and restart the entire container. In addition, you can request an existing application to reload itself, even if you have not declared it to be reloadable in the Tomcat 5 server configuration file.
在许多产品环境中,拥用打包一个新的网络应用程序或者是解包一个已经存在网络应用程序的能力,而不是关闭后再重新启动整个容器,这往往是非常有用的。另个,你可以请求一个存在的应用程序自动重新加载,即使你没有在Tomcat 5中定义可重新加载。
To support these capabilities, Tomcat 5 includes a web application (installed by default on context path /manager ) that supports the following functions:
为了使这些得到支持,Tomcat 5中包括了支持一个以下功能的网络应用程序(安装在默认的路径/manager ):
- Deploy a new web application, on a specified context path, from the uploaded contents of a WAR file.
-
从指定路径上传的WAR文件打包新的WEB应用程序.
- Deploy a new web application, on a specified context path, from the server file system.
-
从指定路径服务器文件系统打包新的WEB应用程序.
- List the currently deployed web applications, as well as the sessions that are currently active for those web apps.
-
列表当前打包的WEB应用程序,包括当前为这些应用程序处于活动的SESSION.
- Reload an existing web application, to reflect changes in the contents of
/WEB-INF/classes or /WEB-INF/lib .
- 重载一个已经存在的应用程序,以使用
/WEB-INF/classes or /WEB-INF/lib下的内容更改生效.
- List the OS and JVM property values.
-
操作系统与JAVA虚拟机属性列表.
- List the available global JNDI resources, for use in deployment tools that are preparing
<ResourceLink> elements nested in a <Context> deployment description.
-
全局JNDI资源变量列表,这是为了使用在打包工具中用上他们.
- List the available security roles defined in the user database.
-
列表在用户数据库中定的可用的安全角色.
- Start a stopped application (thus making it available again).
-
启动一个停止的应用程序(使它再次成为可用).
- Stop an existing application (so that it becomes unavailable), but do not undeploy it.
-
停止应用程序(使用成为不可用),但去不解包.
- Undeploy a deployed web application and delete its document base directory (unless it was deployed from file system).
-
解包应有程序并且删除它的文档基目录(除非它是从文件系统打包的).
There are two ways to configure the Manager web application Context :
这里有两种方式配置管理应用程序环境:
If you have Tomcat configured to support multiple virtual hosts (websites) you would need to configure a Manager for each.
如果你已经将Tomcat配置成支持多个虚拟主机(网站),你就需要分别为其配置一个管理器.
There are three ways to use the Manager web application.
有三种方式可以应用网络应用程序管理器.
- As an application with a user interface you use in your browser. Here is an example URL where you can replace
localhost with your website host name: http://localhost/manager/html/ .
-
在你的浏览器中成为一个具有用户接口的应用程序.这里有一个示例URL,在这里你可以用你的网站主机名取代localhost.
- A minimal version using HTTP requests only which is suitable for use by scripts setup by system administrators. Commands are given as part of the request URI, and responses are in the form of simple text that can be easily parsed and processed. See Supported Manager Commands for more information.
-
一个仅仅使用HTTP请求基本版本,该版本适用于系统管理员用脚本进行的配置.命令作为请求URL的一部份,并且回应是以简单的文本的形式,这些文本可以很方便的被语法分析及处理.查看支持管理命令了解更详细的信息.
- A convenient set of task definitions for the Ant (version 1.4 or later) build tool. See Executing Manager Commands With Ant for more information.
-
为Ant(1.4或者是更高版本)编译工具的一种方便的任务定义设置.查看用Ant执行管理命令了解更多信息.
Future versions of Tomcat 5 will include administrative functionality that is presented in (at least) the following forms:
Tomcat 5 后面的版本包括了以下形式的管理功能:
- As web services, so that Tomcat administration can be easily integrated into remote and/or non-Java management environments.
-
作为网络服务器.这样Tomcat管理就可以很容易的集成到远程以及/或者是非JAVA管理环境中.
- As a web application with a nice user interface (built on top of the web services processing layer) for easy Tomcat administration via a web browser.
-
为简化通过网络浏览器对Tomcat管理,成为具有好的用户接口的网络应用程序(基于网络服务处理层顶层).
|
|
Configuring Manager Application Access |
The description below uses the variable name $CATALINA_HOME to refer to the directory into which you have installed Tomcat 5, and is the base directory against which most relative paths are resolved. However, if you have configured Tomcat 5 for multiple instances by setting a CATALINA_BASE directory, you should use $CATALINA_BASE instead of $CATALINA_HOME for each of these references.
It would be quite unsafe to ship Tomcat with default settings that allowed anyone on the Internet to execute the Manager application on your server. Therefore, the Manager application is shipped with the requirement that anyone who attempts to use it must authenticate themselves, using a username and password that have the role manager associated with them. Further, there is no username in the default users file (<conf></conf>$CATALINA_HOME/conf/tomcat-users.xml) that is assigned this role. Therefore, access to the Manager application is completely disabled by default.
To enable access to the Manager web application, you must either create a new username/password combination and associate the role name manager with it, or add the manager role to some existing username/password combination. Exactly where this is done depends on which Realm implementation you are using:
-
MemoryRealm - If you have not customized your
$CATALINA_HOME/conf/server.xml to select a different one, Tomcat 5 defaults to an XML-format file stored at $CATALINA_HOME/conf/tomcat-users.xml , which can be edited with any text editor. This file contains an XML <user> for each individual user, which might look something like this:
|
|
|
|
<user name="craigmcc" password="secret" roles="standard,manager" />
|
|
|
|
|
which defines the username and password used by this individual to log on, and the role names he or she is associated with. You can add the manager role to the comma-delimited roles attribute for one or more existing users, and/or create new users with that assigned role.
-
JDBCRealm - Your user and role information is stored in a database accessed via JDBC. Add the manager role to one or more existing users, and/or create one or more new users with this role assigned, following the standard procedures for your environment.
-
JNDIRealm - Your user and role information is stored in a directory server accessed via LDAP. Add the manager role to one or more existing users, and/or create one or more new users with this role assigned, following the standard procedures for your environment.
The first time you attempt to issue one of the Manager commands described in the next section, you will be challenged to log on using BASIC authentication. The username and password you enter do not matter, as long as they identify a valid user in the users database who possesses the role manager.
In addition to the password restrictions the manager web application could be restricted by the remote IP address or host by adding a RemoteAddrValve or RemoteHostValve . Here is an example of restricting access to the localhost by IP address:
<Context path="/manager" debug="0" privileged="true"
docBase="/usr/local/kinetic/tomcat5/server/webapps/manager">
<Valve className="org.apache.catalina.valves.RemoteAddrValve"
allow="127.0.0.1"/>
</Context>
|
Supported Manager Commands |
All commands that the Manager application knows how to process are specified in a single request URI like this:
|
|
|
|
http://{host}:{port}/manager/{command}?{parameters}
|
|
|
|
|
where {host} and {port} represent the hostname and port number on which Tomcat is running, {command} represents the Manager command you wish to execute, and {parameters} represents the query parameters that are specific to that command. In the illustrations below, customize the host and port appropriately for your installation.
Most commands accept one or more of the following query parameters:
-
path - The context path (including the leading slash) of the web application you are dealing with. To select the ROOT web application, specify "/". NOTE - It is not possible to perform administrative commands on the Manager application itself.
-
war - URL of a web application archive (WAR) file, pathname of a directory which contains the web application, or a Context configuration ".xml" file. You can use URLs in any of the following formats:
-
file:/absolute/path/to/a/directory - The absolute path of a directory that contains the unpacked version of a web application. This directory will be attached to the context path you specify without any changes.
-
file:/absolute/path/to/a/webapp.war - The absolute path of a web application archive (WAR) file. This is valid only for the
/deploy command, and is the only acceptable format to that command.
-
jar:file:/absolute/path/to/a/warfile.war!/ - The URL to a local web application archive (WAR) file. You can use any syntax that is valid for the
JarURLConnection class for reference to an entire JAR file.
-
file:/absolute/path/to/a/context.xml - The absolute path of a web application Context configuration ".xml" file which contains the Context configuration element.
-
directory - The directory name for the web applciation context in the Host's application base directory.
-
webapp.war - The name of a web application war file located in the Host's application base directory.
Each command will return a response in text/plain format (i.e. plain ASCII with no HTML markup), making it easy for both humans and programs to read). The first line of the response wil begin with either OK or FAIL , indicating whether the requested command was successful or not. In the case of failure, the rest of the first line will contain a description of the problem that was encountered. Some commands include additional lines of information as described below.
Internationalization Note - The Manager application looks up its message strings in resource bundles, so it is possible that the strings have been translated for your platform. The examples below show the English version of the messages.
WARNING: the legacy commands /install and /remove are deprecated. They are presently equivalent to /deploy and /undeploy , but could be removed in a future release.
Deploy A New Application Remotely |
|
|
|
|
http://localhost:8080/manager/deploy?path=/foo
|
|
|
|
|
Upload the web application archive (WAR) file that is specified as the request data in this HTTP PUT request, install it into the appBase directory of our corresponding virtual host, and start it on the context path specified by the path request parameter. If no path is specified the directory name or the war file name without the .war extension is used as the path. The application can later be undeployed (and the corresponding application directory removed) by use of the /undeploy .
The .WAR file may include Tomcat specific deployment configuration, by including a Context configuration XML file in /META-INF/context.xml .
URL parameters include:
-
update : When set to true, any existing update will be undeployed first. The default value is set to false.
-
tag : Specifying a tag name, this allows associating the deployed webapp with a version number. The application version can be later redeployed when needed using only the tag.
NOTE - This command is the logical opposite of the /undeploy command.
If installation and startup is successful, you will receive a response like this:
|
|
|
|
OK - Deployed application at context path /foo
|
|
|
|
|
Otherwise, the response will start with FAIL and include an error message. Possible causes for problems include:
-
Application already exists at path /foo
The context paths for all currently running web applications must be unique. Therefore, you must undeploy the existing web application using this context path, or choose a different context path for the new one. The update parameter may be specified as a parameter on the URL, with a value of true to avoid this error. In that case, an undeploy will be performed on an existing application before performing the deployment.
-
Encountered exception
An exception was encountered trying to start the new web application. Check the Tomcat 5 logs for the details, but likely explanations include problems parsing your /WEB-INF/web.xml file, or missing classes encountered when initializing application event listeners and filters.
-
Invalid context path was specified
The context path must start with a slash character. To reference the ROOT web application use "/".
-
No context path was specified
The path parameter is required.
|
Deploy A New Application from a Local Path |
Deploy and start a new web application, attached to the specified context path (which must not be in use by any other web application). This command is the logical opposite of the /undeploy command.
There are a number of different ways the deploy command can be used.
Deploy a version of a previously deployed webapp
This can be used to deploy a previous version of a web application, which has been deployed using the tag attribute. Note that the work directory for the manager webapp will contain the previously deployed WARs; removing it would make the deployment fail.
|
|
|
|
http://localhost:8080/manager/deploy?path=/footoo&tag=footag
|
|
|
|
|
Deploy a Directory or WAR by URL
Deploy a web application directory or ".war" file located on the Tomcat server. If no path is specified, the directory name or the war file name without the ".war" extension is used as the path. The war parameter specifies a URL (including the file: scheme) for either a directory or a web application archive (WAR) file. The supported syntax for a URL referring to a WAR file is described on the Javadocs page for the java.net.JarURLConnection class. Use only URLs that refer to the entire WAR file.
In this example the web application located in the directory /path/to/foo on the Tomcat server is deployed as the web application context named /footoo .
|
|
|
|
http://localhost:8080/manager/deploy?path=/footoo&war=file:/path/to/foo
|
|
|
|
|
In this example the ".war" file /path/to/bar.war on the Tomcat server is deployed as the web application context named /bar . Notice that there is no path parameter so the context path defaults to the name of the web application archive file without the ".war" extension.
|
|
|
|
http://localhost:8080/manager/deploy?war=jar:file:/path/to/bar.war!/
|
|
|
|
|
Deploy a Directory or War from the Host appBase
Deploy a web application directory or ".war" file located in your Host appBase directory. If no path is specified the directory name or the war file name without the ".war" extension is used as the path.
In this example the web application located in a sub directory named foo in the Host appBase directory of the Tomcat server is deployed as the web application context named /foo . Notice that there is no path parameter so the context path defaults to the name of the web application directory.
|
|
|
|
http://localhost:8080/manager/deploy?war=foo
|
|
|
|
|
In this example the ".war" file bar.war located in your Host appBase directory on the Tomcat server is deployed as the web application context named /bartoo .
|
|
|
|
http://localhost:8080/manager/deploy?path=/bartoo&war=bar.war
|
|
|
|
|
Deploy using a Context configuration ".xml" file
If the Host deployXML flag is set to true you can deploy a web application using a Context configuration ".xml" file and an optional ".war" file or web application directory. The context path is not used when deploying a web application using a context ".xml" configuration file.
A Context configuration ".xml" file can contain valid XML for a web application Context just as if it were configured in your Tomcat server.xml configuration file. Here is an example:
|
|
|
|
<Context path="/foobar" docBase="/path/to/application/foobar"
debug="0">
<!-- Link to the user database we will get roles from -->
<ResourceLink name="users" global="UserDatabase"
type="org.apache.catalina.UserDatabase"/>
</Context>
|
|
|
|
|
When the optional war parameter is set to the URL for a web application ".war" file or directory it overrides any docBase configured in the context configuration ".xml" file.
Here is an example of deploying an application using a Context configuration ".xml" file.
|
|
|
|
http://localhost:8080/manager/deploy?config=file:/path/context.xml
|
|
|
|
|
Here is an example of deploying an application using a Context configuration ".xml" file and a web application ".war" file located on the server.
|
|
|
|
http://localhost:8080/manager/deploy?config=file:/path/context.xml&war=jar:file:/path/bar.war!/
|
|
|
|
|
Deployment Notes
If the Host is configured with unpackWARs=true and you deploy a war file, the war will be unpacked into a directory in your Host appBase directory.
If the application war or directory is installed in your Host appBase directory and either the Host is configured with autoDeploy=true or liveDeploy=true, the Context path must match the directory name or war file name without the ".war" extension.
For security when untrusted users can manage web applications, the Host deployXML flag can be set to false. This prevents untrusted users from deploying web applications using a configuration XML file and also prevents them from deploying application directories or ".war" files located outside of their Host appBase.
Deploy Response
If installation and startup is successful, you will receive a response like this:
|
|
|
|
OK - Deployed application at context path /foo
|
|
|
|
|
Otherwise, the response will start with FAIL and include an error message. Possible causes for problems include:
-
Application already exists at path /foo
The context paths for all currently running web applications must be unique. Therefore, you must undeploy the existing web application using this context path, or choose a different context path for the new one. The update parameter may be specified as a parameter on the URL, with a value of true to avoid this error. In that case, an undeploy will be performed on an existing application before performing the deployment.
-
Document base does not exist or is not a readable directory
The URL specified by the war parameter must identify a directory on this server that contains the "unpacked" version of a web application, or the absolute URL of a web application archive (WAR) file that contains this application. Correct the value specified by the war parameter.
-
Encountered exception
An exception was encountered trying to start the new web application. Check the Tomcat 5 logs for the details, but likely explanations include problems parsing your /WEB-INF/web.xml file, or missing classes encountered when initializing application event listeners and filters.
-
Invalid application URL was specified
The URL for the directory or web application that you specified was not valid. Such URLs must start with file: , and URLs for a WAR file must end in ".war".
-
Invalid context path was specified
The context path must start with a slash character. To reference the ROOT web application use "/".
-
Context path must match the directory or WAR file name:
If the application war or directory is installed in your Host appBase directory and either the Host is configured with autoDeploy=true or liveDeploy=true, the Context path must match the directory name or war file name without the ".war" extension.
-
Only web applications in the Host web application directory can be installed
If the Host deployXML flag is set to false this error will happen if an attempt is made to deploy a web application directory or ".war" file outside of the Host appBase directory.
|
| |
相关推荐
通过阅读《Tomcat安全性.doc》和《TomcatSecurity.pdf》文档,你可以进一步了解Tomcat的安全配置细节,如如何配置用户角色、设置防火墙规则,以及如何进行日志监控,以便及时发现和应对安全威胁。 总结来说,理解...
- **简介**:虽然文档中未提及具体的翻译工具名称,但在开发过程中可能会遇到需要查阅英文文档或资料的情况,因此配备一款可靠的翻译工具对于理解和解决问题是非常有帮助的。 #### 二、环境配置 1. **JDK安装配置...
5. **检查效果**:启动MyEclipse后,查看菜单、工具栏和帮助文档等是否成功变为中文,如果有部分未汉化的部分,可能是汉化包不完整或者安装过程出现问题。 需要注意的是,汉化包的兼容性和完整性至关重要,不同版本...
3. **MyEclipse开发环境**:虽然在描述中并未明确提及,但从上下文中推测可能是指开发工具的选择。MyEclipse是一个集成了多种开发工具的IDE,可以用来开发、调试Java应用。 4. **Tomcat服务器**:Tomcat是一个免费...
【MyEclipse汉化包】是一款专为Java开发者设计的集成开发环境(IDE)的中文语言包,旨在帮助那些在英语环境下使用MyEclipse遇到困难的用户,尤其是初学者,提供更加友好、易于理解的界面。MyEclipse是基于Eclipse...
- 如果用户再次请求同一个JSP页面,并且该页面自从上次请求以来未被修改过,则服务器会直接使用之前编译好的Servlet来响应请求。 - 这种做法提高了性能,避免了每次请求都需要重新编译JSP文件的过程。 #### 三、...
为了方便中国用户,Eclipse提供了汉化插件,使得界面和帮助文档转换为简体中文,提高开发者的使用体验。本篇文章将详细讲解如何安装和使用Eclipse的汉化插件,并介绍与Java EE开发相关的配置。 首先,我们要明确的...
10. **文档编写**:与"论文"标签对应,项目应包含详细的设计文档、需求分析、系统架构图、数据库设计图、使用手册等,帮助理解系统实现和维护。 通过深入研究这些知识点,并结合实际代码,我们可以全面了解和评估这...
该系统可能是为了帮助教师管理学生的作业提交、评分以及反馈,同时也可能包含学生提交作业、查看成绩和接收教师评价的功能。 【描述解析】 描述中提到的是同一个标题,即"基于JSP的作业管理系统源码.zip",这暗示了...
3. 利用MyEclipse开发平台编写和调试Java代码,使用Tomcat服务器部署系统。 4. 采用Java架构开发系统,设计具体功能模块,优化系统界面。 5. 应用功能测试方法,对系统进行测试和功能完善。 **开发工具和技术路线**...
3. **文档**:包括论文文档,详细介绍了系统的设计理念、架构、功能模块、技术实现、性能测试等方面。 4. **图片和资源**:可能包含系统使用的logo、图标和其他静态资源。 5. **其他辅助文件**:如README文件,...
基于EJB的真实世界模型,附源代码,部分功能需JSP配合完成。 J2ME优化压缩PNG文件 4个目标文件 内容索引:JAVA源码,综合应用,J2me游戏,PNG,图形处理 这是个J2ME控制台程序,它能剔除PNG文件中的非关键数据段,减少...
WebSocket4J 并未实现客户端通讯协议,所以不能用它来连接 WebSocket 服务器。 Struts验证码插件 JCaptcha4Struts2 JCaptcha4Struts2 是一个 Struts2的插件,用来增加验证码的支持,使用时只需要用一个 JSP 标签 ...
WebSocket4J 并未实现客户端通讯协议,所以不能用它来连接 WebSocket 服务器。 Struts验证码插件 JCaptcha4Struts2 JCaptcha4Struts2 是一个 Struts2的插件,用来增加验证码的支持,使用时只需要用一个 JSP 标签 ...
WebSocket4J 并未实现客户端通讯协议,所以不能用它来连接 WebSocket 服务器。 Struts验证码插件 JCaptcha4Struts2 JCaptcha4Struts2 是一个 Struts2的插件,用来增加验证码的支持,使用时只需要用一个 JSP 标签 ...
WebSocket4J 并未实现客户端通讯协议,所以不能用它来连接 WebSocket 服务器。 Struts验证码插件 JCaptcha4Struts2 JCaptcha4Struts2 是一个 Struts2的插件,用来增加验证码的支持,使用时只需要用一个 JSP 标签 ...
WebSocket4J 并未实现客户端通讯协议,所以不能用它来连接 WebSocket 服务器。 Struts验证码插件 JCaptcha4Struts2 JCaptcha4Struts2 是一个 Struts2的插件,用来增加验证码的支持,使用时只需要用一个 JSP 标签 ...
WebSocket4J 并未实现客户端通讯协议,所以不能用它来连接 WebSocket 服务器。 Struts验证码插件 JCaptcha4Struts2 JCaptcha4Struts2 是一个 Struts2的插件,用来增加验证码的支持,使用时只需要用一个 JSP 标签 ...
WebSocket4J 并未实现客户端通讯协议,所以不能用它来连接 WebSocket 服务器。 Struts验证码插件 JCaptcha4Struts2 JCaptcha4Struts2 是一个 Struts2的插件,用来增加验证码的支持,使用时只需要用一个 JSP 标签 ...
WebSocket4J 并未实现客户端通讯协议,所以不能用它来连接 WebSocket 服务器。 Struts验证码插件 JCaptcha4Struts2 JCaptcha4Struts2 是一个 Struts2的插件,用来增加验证码的支持,使用时只需要用一个 JSP 标签 ...