Tomcat帮助文档翻译(未完成)

保姆级教程:用VESTA软件5分钟搞定纳米颗粒Wulff Construction建模(以Au金为例) 本文提供了一份详细的VESTA软件教程,指导用户如何在5分钟内完成纳米颗粒Wulff Construction建模,特别以金(Au)为例。从环境搭建、基础晶体结构创建到Wulff Construction设置和可视化优化,涵盖了全流程操作步骤和常见问题解决方案,适合科研新手快速上手。 阅读详情

偶也是学习,不过,觉得每次都是读英文,麻烦,就希望把它翻译成中文,为自己,也为其它想学习的朋友,呵呵.
不过,由于内容比较多,可能翻译的时间要多一点,如果有兴趣合作的朋友,可以回复BLOG,留言您想翻译那一段.
让我们一起完成该内容.

不过,为了增加文档的可阅读性,把阅读当成一种享受,请在翻译的时候遵守以下几点:

1).翻译的字体一律用绿色.保证阅读不那么伤眼睛.

2).重点标题用红色标明,重点内容用蓝色标注.

The Jakarta Project

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:

这里有两种方式配置管理应用程序环境:

  • Install the manager.xml context configuration file in the $CATALINA_HOME/conf/[enginename]/[hostname] folder.
  • 安装环境配置文件manager.xml 在文件夹$CATALINA_HOME/conf/[enginename]/[hostname]中.
  • Configure the Manager Context within the Host configuration in your Tomcat server.xml configuration. Here is an example:

    在你的Tomcat server.xml 配置中的主机配置下配置管理环境.下面是一个例子:

    <Context path="/manager" debug="0" privileged="true"
             docBase="/usr/local/kinetic/tomcat5/server/webapps/manager">
    </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 ( $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.
List Currently Deployed Applications
http://localhost:8080/manager/list

List the context paths, current status (running or stopped), and number of active sessions for all currently deployed web applications. A typical response immediately after starting Tomcat might look like this:

OK - Listed applications for virtual host localhost
/webdav:running:0
/examples:running:0
/manager:running:0
/:running:0
Reload An Existing Application
http://localhost:8080/manager/reload?path=/examples

Signal an existing application to shut itself down and reload. This can be useful when the web application context is not reloadable and you have updated classes or property files in the /WEB-INF/classes directory or when you have added or updated jar files in the /WEB-INF/lib directory.

NOTE: The /WEB-INF/web.xml web application configuration file is not reread on a reload. If you have made changes to your web.xml file you must stop then start the web application.

If this command succeeds, you will see a response like this:

OK - Reloaded application at context path /examples

Otherwise, the response will start with FAIL and include an error message. Possible causes for problems include:

  • Encountered exception

    An exception was encountered trying to restart the web application. Check the Tomcat 5 logs for the details.

  • Invalid context path was specified

    The context path must start with a slash character. To reference the ROOT web application use "/".

  • No context exists for path /foo

    There is no deployed application on the context path that you specified.

  • No context path was specified
    The path parameter is required.
  • Reload not supported on WAR deployed at path /foo
    Currently, application reloading (to pick up changes to the classes or web.xml file) is not supported when a web application is deployed directly from a WAR file. It only works when the web application is deployed from an unpacked directory. If you are using a WAR file, you should undeploy and then deploy or deploy with the update parameter the application again to pick up your changes.
List OS and JVM Properties
http://localhost:8080/manager/serverinfo

Lists information about the Tomcat version, OS, and JVM properties.

If an error occurs, the response will start with FAIL and include an error message. Possible causes for problems include:

  • Encountered exception

    An exception was encountered trying to enumerate the system properties. Check the Tomcat 5 logs for the details.

List Available Global JNDI Resources
http://localhost:8080/manager/resources[?type=xxxxx]

List the global JNDI resources that are available for use in resource links for context configuration files. If you specify the type request parameter, the value must be the fully qualified Java class name of the resource type you are interested in (for example, you would specify javax.sql.DataSource to acquire the names of all available JDBC data sources). If you do not specify the type request parameter, resources of all types will be returned.

Depending on whether the type request parameter is specfied or not, the first line of a normal response will be:

  OK - Listed global resources of all types

or

  OK - Listed global resources of type xxxxx

followed by one line for each resource. Each line is composed of fields delimited by colon characters (":"), as follows:

  • Global Resource Name - The name of this global JNDI resource, which would be used in the global attribute of a <ResourceLink> element.
  • Global Resource Type - The fully qualified Java class name of this global JNDI resource.

If an error occurs, the response will start with FAIL and include an error message. Possible causes for problems include:

  • Encountered exception

    An exception was encountered trying to enumerate the global JNDI resources. Check the Tomcat 5 logs for the details.

  • No global JNDI resources are available

    The Tomcat server you are running has been configured without global JNDI resources.

List Available Security Roles
http://localhost:8080/manager/roles

List the security role names (and corresponding descriptions) that are available in the org.apache.catalina.UserDatabase resource that is linked to the users resource reference in the web.xml file for the Manager web application. This would typically be used, for example, by a deployment tool that wanted to create <security-role-ref> elements to map security role names used in a web application to the role names actually defined within the container.

By default, the users resource reference is pointed at the global UserDatabase resource. If you choose to utilize a different user database per virtual host, you should modify the <ResourceLink> element in the default manager.xml context configuration file to point at the global user database resource for this virtual host.

When this command is executed, the first line of the response will be:

  OK - Listed security roles

followed by one line for each security role. Each line is composed of fields delimited by colon characters (":") as follows:

  • Security Role Name - A security role name that is known to Tomcat in the user database.
  • Description - Description of this security role (useful in creating user interfaces for selecting roles.

If an error occurs, the response will start with FAIL and include an error message. Possible causes for problems include:

  • Cannot resolve user database reference - A JNDI error prevented the successful lookup of the org.apache.catalina.UserDatabase resource. Check the Tomcat log files for a stack trace associated with this error.
  • No user database is available - You have not configured a resource reference for the users resource that points at an appropriate user database instance. Check your manager.xml file and ensure that you have created an appropriate <ResourceLink> or <ResourceParams> element for this resource.
Session Statistics
http://localhost:8080/manager/sessions?path=/examples

Display the default session timeout for a web application, and the number of currently active sessions that fall within ten-minute ranges of their actual timeout times. For example, after restarting Tomcat and then executing one of the JSP samples in the /examples web app, you might get something like this:

OK - Session information for application at context path /examples
Default maximum session inactive interval 30 minutes
30 - <40 minutes:1 sessions
Start an Existing Application
http://localhost:8080/manager/start?path=/examples

Signal a stopped application to restart, and make itself available again. Stopping and starting is useful, for example, if the database required by your application becomes temporarily unavailable. It is usually better to stop the web application that relies on this database rather than letting users continuously encounter database exceptions.

If this command succeeds, you will see a response like this:

OK - Started application at context path /examples

Otherwise, the response will start with FAIL and include an error message. Possible causes for problems include:

  • Encountered exception

    An exception was encountered trying to start the web application. Check the Tomcat 5 logs for the details.

  • Invalid context path was specified

    The context path must start with a slash character. To reference the ROOT web application use "/".

  • No context exists for path /foo

    There is no deployed application on the context path that you specified.

  • No context path was specified
    The path parameter is required.
Stop an Existing Application
http://localhost:8080/manager/stop?path=/examples

Signal an existing application to make itself unavailable, but leave it deployed. Any request that comes in while an application is stopped will see an HTTP error 404, and this application will show as "stopped" on a list applications command.

If this command succeeds, you will see a response like this:

OK - Stopped application at context path /examples

Otherwise, the response will start with FAIL and include an error message. Possible causes for problems include:

  • Encountered exception

    An exception was encountered trying to stop the web application. Check the Tomcat 5 logs for the details.

  • Invalid context path was specified

    The context path must start with a slash character. To reference the ROOT web application use "/".

  • No context exists for path /foo

    There is no deployed application on the context path that you specified.

  • No context path was specified
    The path parameter is required.
Undeploy an Existing Application
http://localhost:8080/manager/undeploy?path=/examples

WARNING - This command will delete any web application artifacts that exist within appBase directory (typically "webapps") for this virtual host. This will delete the the application .WAR, if present, the application directory resulting either from a deploy in unpacked form or from .WAR expansion as well as the XML Context definition from $CATALINA_HOME/conf/[enginename]/[hostname]/ directory. If you simply want to take an application out of service, you should use the /stop command instead.

Signal an existing application to gracefully shut itself down, and remove it from Tomcat (which also makes this context path available for reuse later). In addition, the document root directory is removed, if it exists in the appBase directory (typically "webapps") for this virtual host. This command is the logical opposite of the /deploy command.

If this command succeeds, you will see a response like this:

OK - Undeployed application at context path /examples

Otherwise, the response will start with FAIL and include an error message. Possible causes for problems include:

  • Encountered exception

    An exception was encountered trying to undeploy the web application. Check the Tomcat 5 logs for the details.

  • Invalid context path was specified

    The context path must start with a slash character. To reference the ROOT web application use "/".

  • No context exists for path /foo

    There is no deployed application on the context path that you specified.

  • No context path was specified
    The path parameter is required.
Executing Manager Commands With Ant

In addition to the ability to execute Manager commands via HTTP requests, as documented above, Tomcat 5 includes a convenient set of Task definitions for the Ant (version 1.4 or later) build tool. In order to use these commands, you must perform the following setup operations:

  • Download the binary distribution of Ant from http://ant.apache.org. You must use version 1.4 or later.
  • Install the Ant distribution in a convenient directory (called ANT_HOME in the remainder of these instructions).
  • Copy the file server/lib/catalina-ant.jar from your Tomcat 5 installation into Ant's library directory ($ANT_HOME/lib).
  • Add the $ANT_HOME/bin directory to your PATH environment variable.
  • Configure at least one username/password combination in your Tomcat user database that includes the manager role.

To use custom tasks within Ant, you must declare them first with a <taskdef> element. Therefore, your build.xml file might look something like this:

<project name="My Application" default="compile" basedir=".">

  <!-- Configure the directory into which the web application is built -->
  <property name="build"    value="${basedir}/build"/>

  <!-- Configure the context path for this application -->
  <property name="path"     value="/myapp"/>

  <!-- Configure properties to access the Manager application -->
  <property name="url"      value="http://localhost:8080/manager"/>
  <property name="username" value="myusername"/>
  <property name="password" value="mypassword"/>

  <!-- Configure the custom Ant tasks for the Manager application -->
  <taskdef name="deploy"    classname="org.apache.catalina.ant.DeployTask"/>
  <taskdef name="list"      classname="org.apache.catalina.ant.ListTask"/>
  <taskdef name="reload"    classname="org.apache.catalina.ant.ReloadTask"/>
  <taskdef name="resources" classname="org.apache.catalina.ant.ResourcesTask"/>
  <taskdef name="roles"     classname="org.apache.catalina.ant.RolesTask"/>
  <taskdef name="start"     classname="org.apache.catalina.ant.StartTask"/>
  <taskdef name="stop"      classname="org.apache.catalina.ant.StopTask"/>
  <taskdef name="undeploy"  classname="org.apache.catalina.ant.UndeployTask"/>

  <!-- Executable Targets -->
  <target name="compile" description="Compile web application">
    <!-- ... construct web application in ${build} subdirectory, and
            generated a ${path}.war ... -->
  </target>

  <target name="deploy" description="Install web application"
          depends="compile">
    <deploy url="${url}" username="${username}" password="${password}"
            path="${path}" war="${build}${path}.war"/>
  </target>

  <target name="reload" description="Reload web application"
          depends="compile">
    <reload  url="${url}" username="${username}" password="${password}"
            path="${path}"/>
  </target>

  <target name="undeploy" description="Remove web application">
    <undeploy url="${url}" username="${username}" password="${password}"
            path="${path}"/>
  </target>

</project>

Now, you can execute commands like ant deploy to deploy the application to a running instance of Tomcat, or ant reload to tell Tomcat to reload it. Note also that most of the interesting values in this build.xml file are defined as replaceable properties, so you can override their values from the command line. For example, you might consider it a security risk to include the real manager password in your build.xml file's source code. To avoid this, omit the password property, and specify it from the command line:

  ant -Dpassword=secret deploy
Tasks output capture

Using Ant version 1.6.2 or later, the Catalina tasks offer the option to capture their output in properties or external files. They support directly the following subset of the <redirector> type attributes:

AttributeDescriptionRequired
outputName of a file to which to write the output. If the error stream is not also redirected to a file or property, it will appear in this output.No
errorThe file to which the standard error of the command should be redirected.No
logErrorThis attribute is used when you wish to see error output in Ant's log and you are redirecting output to a file/property. The error output will not be included in the output file/property. If you redirect error with the error or errorProperty attributes, this will have no effect.No
appendWhether output and error files should be appended to or overwritten. Defaults to false.No
createemptyfilesWhether output and error files should be created even when empty. Defaults to true.No
outputpropertyThe name of a property in which the output of the command should be stored. Unless the error stream is redirected to a separate file or stream, this property will include the error output.No
errorpropertyThe name of a property in which the standard error of the command should be stored.No

A couple of additional attributes can also be specified:

AttributeDescriptionRequired
alwaysLogThis attribute is used when you wish to see the output you are capturing, appearing also in the Ant's log. It must not be used unless you are capturing task output. Defaults to false. This attribute will be supported directly by <redirector> in Ant 1.6.3No
failonerrorThis attribute is used when you wish to avoid that any manager command processing error terminates the ant execution. Defaults to true. It must be set to false, if you want to capture error output, otherwise execution will terminate before anything can be captured.
This attribute acts only on manager command execution, any wrong or missing command attribute will still cause Ant execution termination.
No

They also support the embedded <redirector> element in which you can specify its full set of attributes, but input, inputstring and inputencoding that, even if accepted, are not used because they have no meaning in this context. Refer to ant manual for details on <redirector> element attributes.

Here is a sample build file extract that shows how this output redirection support can be used:

	<target name="manager.deploy"
		depends="context.status"
		if="context.notInstalled">
		<deploy url="${mgr.url}"
			username="${mgr.username}"
			password="${mgr.password}"
			path="${mgr.context.path}"
			config="${mgr.context.descriptor}"/>
	</target>

	<target name="manager.deploy.war"
		depends="context.status"
		if="context.deployable">
		<deploy url="${mgr.url}"
			username="${mgr.username}"
			password="${mgr.password}"
			update="${mgr.update}"
			path="${mgr.context.path}"
			war="${mgr.war.file}"/>
	</target>
	
	<target name="context.status">
		<property name="running" value="${mgr.context.path}:running"/>
		<property name="stopped" value="${mgr.context.path}:stopped"/>
	
		<list url="${mgr.url}"
			outputproperty="ctx.status"
			username="${mgr.username}"
			password="${mgr.password}">
		</list>
		
		<condition property="context.running">
			<contains string="${ctx.status}" substring="${running}"/>
		</condition>
		<condition property="context.stopped">
			<contains string="${ctx.status}" substring="${stopped}"/>
		</condition>
		<condition property="context.notInstalled">
			<and>
				<isfalse value="${context.running}"/>
				<isfalse value="${context.stopped}"/>
			</and>
		</condition>
		<condition property="context.deployable">
			<or>
				<istrue value="${context.notInstalled}"/>
				<and>
					<istrue value="${context.running}"/>
					<istrue value="${mgr.update}"/>
				</and>
				<and>
					<istrue value="${context.stopped}"/>
					<istrue value="${mgr.update}"/>
				</and>
			</or>
		</condition>
		<condition property="context.undeployable">
			<or>
				<istrue value="${context.running}"/>
				<istrue value="${context.stopped}"/>
			</or>
		</condition>
	</target>

WARNING: even if it doesn't make many sense, and is always a bad idea, calling a Catalina task more than once, badly set Ant tasks depends chains may cause that a task be called more than once in the same Ant run, even if not intended to. A bit of caution should be exercised when you are capturing output from that task, because this could lead to something unexpected:

  • when capturing in a property you will find in it only the output from the first call, because Ant properties are immutable and once set they cannot be changed,
  • when capturing in a file, each run will overwrite it and you will find in it only the last call output, unless you are using the append="true" attribute, in which case you will see the output of each task call appended to the file.

 

Using the JMX Proxy Servlet
What is JMX Proxy Servlet
The JMX Proxy Servlet is a lightweight proxy to get and set the tomcat internals. (Or any class that has been exposed via an MBean) Its usage is not very user friendly but the UI is extremely help for integrating command line scripts for monitoring and changing the internals of tomcat. You can do two things with the proxy: get information and set information. For you to really understand the JMX Proxy Servlet, you should have a general understanding of JMX. If you don't know what JMX is, then prepare to be confused.
JMX Query command
This takes the form:
http://webserver/manager/jmxproxy/?qry=STUFF
Where STUFF is the JMX query you wish to perform. For example, here are some queries you might wish to run:
  • qry=*%3Atype%3DRequestProcessor%2C* --> type=RequestProcessor which will locate all workers which can process requests and report their state.
  • qry=*%3Aj2eeType=Servlet%2c* --> j2eeType=Servlet which return all loaded servlets.
  • qry=Catalina%3Atype%3DEnvironment%2Cresourcetype%3DGlobal%2Cname%3DsimpleValue --> Catalina:type=Environment,resourcetype=Global,name=simpleValue which look for a specific MBean by the given name.
You'll need to experiment with this to really understand its capabilites. If you provide no qry parameter, then all of the MBeans will be displayed. We really recommend looking at the tomcat source code and understand the JMX spec to get a better understanding of all the queries you may run.
JMX Set command
Now that you can query an MBean, its time to muck with Tomcat's internals! The general form of the set command is :
http://webserver/manager/jmxproxy/?set=BEANNAME&att=MYATTRIBUTE&val=NEWVALUE
So you need to provide 3 request parameters:
  1. set: The full bean name
  2. att: The attribute you wish to alter
  3. val: The new value
If all goes ok, then it will say OK, otherwise an error message will be shown. For example, lets say we wish to turn up debugging on the fly for the ErrorReportValve. The following will set debugging to 10.
http://localhost:8080/manager/jmxproxy/
?set=Catalina%3Atype%3DValve%2Cname%3DErrorReportValve%2Chost%3Dlocalhost&att=debug&val=10
and my result is (YMMV):
Result: ok
Here is what I see if I pass in a bad value. Here is the URL I used, I try set debugging equal to 'cowbell':
http://localhost:8080/manager/jmxproxy/
?set=Catalina%3Atype%3DValve%2Cname%3DErrorReportValve%2Chost%3Dlocalhost&att=debug&val=cowbell
When I try that, my result is
Error: java.lang.NumberFormatException: For input string: "cowbell"

Copyright © 1999-2005, Apache Software Foundation

RK3588开发板NPU加速YOLO目标检测完整实战教程 🚀 RK3588开发板NPU加速YOLO目标检测实战 本文详细介绍了如何在瑞芯微RK3588开发板上利用内置NPU加速YOLO目标检测的全流程: 1️⃣ 环境准备:配置RKNPU2 SDK和aarch64交叉编译器,搭建Ubuntu开发环境 2️⃣ 模型转换:从ONNX格式转换为专用RKNN模型,适配NPU硬件特性 3️⃣ 性能对比:NPU推理将处理时间从833ms降至50ms以下,帧率提升16倍 4️⃣ 实战应用:支持图像/视频流/摄像头实时检测,提供完整编译和运行命令 关键优势:专为边缘AI设计的6T 阅读详情

相关推荐

什么是深度展开网络?如何将迭代算法的每一次迭代展开成深度网络对应的一层?深度展开网络进行端对端训练,其中端对端是什么意思?

在深度学习和机器学习的背景下,“端到端”(End-to-end)训练指的是将输入数据直接映射到最终输出的过程,而不需要任何中间的手动数据预处理或特征工程。- **自然语言处理**:端到端自然语言处理系统可以将自然语言输入直接转化为计算机可理解的语言输出,而不需要对语言进行分解和转化。- **推荐系统**:通过使用深度神经网络,端到端推荐系统可以直接根据用户历史行为预测其未来的兴趣爱好,并推荐相应的产品或服务。4. **直接映射**:从输入到输出的直接映射,中间没有任何拆分或分解的过程。

m0_67897882的博客 5489

Invalid project description相关问题

最近在导入android项目的时候,出现了invalid project description 的问题,字面意思是“非法的项目描述”,为此头疼了好一阵子,网友们给出的答案都不是很全面,我现在根据个人实践一一罗列一下出现对应问题的情况以及解决方案: 1、当你要导入的项目是之前就在本工作区间已经创建过的,只是后来因为种种原因删除了的(not delete on disk):      这种情况下

My life,my way 4756

大模型系统构建的“三驾马车”——Prompt、Context与Harness工程

在LLM应用开发的早期阶段,我们热衷于比拼“提示词”的精妙程度。那时,一个精心构造的思维链CoT就能让模型的表现提升10%以上。随着大模型从“玩具”走向“生产系统”,我们逐渐意识到:单一的 Prompt 只是起点,而非终点。 真正的工业级应用,需要构建一套三层递进的工程体系——Prompt Engineering、Context Engineering 和 Harness Engineering。

西木风落 614

tomcat是什么?

一.tomcat是什么二.目录结构及作用1.bin2.conf3.lib4.logs6.webapps7.work8.其他文件三.session持久化示例1.主要配置文件2.示例一.tomcat是什么Tomcat是Apache 软件基金会(Apache Software Foundation)的Jakarta 项目中的一个核心项目,由Apache、Sun 和其他一些公司及个人共同开发而成。 Tomcat 服务器是一个免费的开放源代码的Web 应用服务器,属于轻量级应用服务器,在中小型系统和并发访问用户不是很

Javajsjsh的博客 1万+

Verilog基础知识11(异步FIFO为什么使用格雷码(gray-code) )

需求说明:Verilog设计 内容       :第一部分 异步FIFO为什么使用格雷码                   第二部分 格雷码在异步FIFO中的使用 来自       :时间的诗 第一部分 异步FIFO为什么使用格雷码 原文:http://www.cnblogs.com/kxk_kxk/p/3931591.html 异步FIFO通

时间的诗 8901

Blender - Shrinkwrap - 更方便的制作贴合模型的表面来建模

Shrinkwrap 修改器 使用 Blender 想要快速建模可以贴合现有模型表面的效果:衣服、皮肤、等效果,可以使用 Shrinkwrap 修改器,这个修改器的名字其实按照英文上的理解,翻译为:收缩的包裹效果 应用 如这块铁皮,它要贴合机身弯曲的效果,可以先建好一个铁皮,再 Shrinkwrap 到一个指定的网格上 留意的参数 Target 要贴合的对象(目前我已知是可以贴合到网格对象上,实在是方便) VertexGroup 顶点组,和之前讲到过的,顶点组可以组设顶点的权重,意思这个可.

Jave.Lin 的学习笔记 6100

Caused by: java.lang.IllegalArgumentException: defaultTarget must start with ‘/’ or with ‘http(s)’

SpringBoot2 集成Spring Security 启动项目时报错。 原因是 默认的url出现错误, 请求开始要以 / 开头。将url开头加上/就好了 //路由策略和访问权限的简单配置 http .formLogin() //启用默认登录页面 .failureForwardUrl("/login?error") //登录失败返回url ....

图图是只猫 4384

Android开发者必看:5分钟搞定MQTT客户端连接EMQX服务器(附完整代码)

本文为Android开发者提供了一份快速实现MQTT客户端连接EMQX服务器的实战指南。通过引入Eclipse Paho SDK,详细讲解了从项目配置、权限申请到核心连接、主题订阅与消息发布的完整流程,并附有即拿即用的Kotlin代码,帮助开发者在物联网应用中高效集成轻量级实时通信功能。

weixin_29228781的博客 280

Tomcat官网参考文档

spring cloud服务间调用采用ribbon,默认是长连接,ribbon客户端默认连接存活时间比tomcat服务端大,当请求量非常小,tomcat服务端超过了连接存活时间主动断开,此时ribbon不知道连接已断开,复用该连接来发送请求,导致NoHttpResponse报错。配置方式:server.tomcat.min-spare-threads=30 默认10。配置方式:server.tomcat.max-threads=200 默认200。

wudiyong22的专栏 1836

从时序博弈到数据稳定:CS1237驱动中的信号滤波与卡尔曼实践

本文探讨了CS1237高精度ADC驱动在复杂工业环境中的信号处理挑战,重点介绍了一阶滤波与自适应卡尔曼滤波算法的实践应用。通过参数优化和动态调整策略,有效提升了数据稳定性和抗干扰能力,为嵌入式系统在噪声环境下的精密测量提供了可靠解决方案。

rnn9storyteller的博客 875

华为OD机试真题 新系统 2026-04-19 Java&Go 实现【分辨率排序】

华为OD机试真题 新系统 2026-04-19 Python&JS 实现【分辨率排序】

MISAYAONE的博客 322

tomcat是什么

tomcat是什么、做什么的,以及与其他同类容器的区别的简单概述 Tomcat 是什么 Tomcat 是由 Apache 开发的一个 Servlet 容器,实现了对 Servlet 和 JSP 的支持,并提供了作为Web服务器的一些特有功能,Tomcat是一种类似于IIS、Apache Http的Web服务端程序,由于 Tomcat 本身也内含了一个 HTTP 服务器,它也可以被视作一个单独的 W...

weixin_43139560的博客 9185

SAP生产订单技术性完成(TECO)操作指南与实战应用

生产订单技术关闭操作指南主要包括单笔和批量关闭两种方式,通过CO02/COHV事务码完成。

m0_47402127的博客 1944

Tomcat帮助文档翻译 未完成

Tomcat帮助文档翻译 未完成

fdyufgf的博客 640

Outlook Express 6 (OE6) for Win7/Win8/Win10

英文版 Outlook Express6.0, 兼容Win7/Win10/WinXP,解压就可用。

SAP B1中文培訓教材_SDK

公司内部培训资料,对开发工具 ,DIAPI, UIAPI,Add-ON有详细解说

Tomcat文档翻译二

安装为了使用Tomcat 5开发web应用程序,你首先要安装它。下面各小节简要的说明了必要的安装步骤。JDKTomcat 5.5被设计运行在J2SE 5.0之上,但它也可以运行在JDK1.4之上,只是要求使用兼容包。对各种平台的兼容JDKs参见http://java.sun.com/j2se/。Tomcat二进制Tomcat服务器安装包从http://java.sun.com/j2se/ 下载。手

ProCoffee99的专栏 1714

锂电池充电器电路设计 里面有电路

锂电池充电器电路设计 里面有电路 3.7V升压到5V电路设计。

Tomcat文档翻译

应用程序开发者手册application:应用程序Context - In a nutshell, a Context is a web application。          简言之,Context就是一个web应用程序。手册主要涵盖以下内容:应用Tomcat设置开发环境、组织源代码、build和test应用程序(application),这些是web应用程序开发的基本步骤。手册不讨论web

ProCoffee99的专栏 2124

jre9下载 jdk9

(Java SE Runtime Environment 9.0) 9.0u175 官方最新版 【x86|x64】

【Tomcat 问题】Tomcat文档

1.离线文档 我分享的是中文版的离线文档,版本有点早的,也可以查看。 如果需要查看最新的API文档,可以去Tomcat官网查看在线文档。 JSP v1.1 和Servlet v2.2 API 编程指南 百度云盘链接:https://pan.baidu.com/s/1RkxKfTmPAcMA7ktVMD8Edg 提取码:31u9 2.在线文档 下面的这些都可以在官网中找到的。 Tomcat 官网:h...

长生的梦呓 519

【Tomcat 6.0官方文档翻译】—— 简介

2019独角兽企业重金招聘Python工程师标准>>> ...

weixin_34138521的博客 177

web server apache tomcat11-01-官方文档入门介绍

整理这个官方翻译的系列,原因是网上大部分的 tomcat 版本比较旧,此版本为 v11 最新的版本。对于管理员和 Web 开发人员来说,在开始之前,有一些重要的信息您应该熟悉。本文档作为对 Tomcat 容器背后一些概念和术语的简要介绍,以及在需要帮助时应该去哪里的指南。

1451

Part II. Getting Started文档翻译(未完成)

文章目录博客概述8.介绍springboot9.系统要求9.1 servlet容器10.安装springboot10.1 对java开发者的安装指导10.2 安装spring boot CLI10.3 从早期版本的Spring Boot升级11.开发你的第一个springboot应用11.1 创建pom文件11.2 添加Classpath Dependencies springboot项目地址:h...

大李出奇迹的博客 308

tomcat安装成功页面翻译

假如你是通过浏览器看到此页面,这表明你已经成功安装Tomcat。恭喜你!而你现在可能已猜到,这个默认的tomcat主页能在本地文件系统找到,地址是:$CATALINA_HOME/webapps/ROOT/index.html"$CATALINA_HOME"是Tomcat的根目录。 假如进入这个网页 是在你预料之外。那要会有两种可能,一种情况是 你无意中浏览到了一个新安装的...

weixin_34242331的博客 835

【Tomcat 6.0官方文档翻译】

2019独角兽企业重金招聘Python工程师标准>>> ...

weixin_34138377的博客 119

XAMPP+TOMCAT 中文档翻译..readme-addon-tomcat.txt

Add-on Tomcat 5.5.15 pl1 (只符合 Apache 2.2.0 = XAMPP 1.5.1)=> Tomcat 5.5.15=> mod_jk/1.2.15 => 另外加上这个tomcat插件需要 20 MB 没使用的空间###################################################################首先 (!

qk31--菩提本无树,明镜亦非台.本来无一物,何处惹尘埃! 1628

xwiki tomcat 安装官方文档-翻译

2019独角兽企业重金招聘Python工程师标准>>> ...

weixin_34365635的博客 429

自己翻译的官方文档:tomcat配置log4j

本文介绍如何配置tomcat使用log4j来替代java.util.logging来产生tomcat本身的日志信息。 说明:只有当我们需要重新配置tomcat来使用Apache log4j来记录tomcat本身的日志时才需要这部分所讲内容。当仅仅想在我们的web应用程序中使用log4j时这些操作不是必要的。如果是仅仅想在web应用中使用log4j,只要把log4j.jar和log4j.prope

bitsjx的专栏 2960
上一篇: 我教你怎么擒老鼠-给有电脑的朋友一个建设
下一篇: Eclipse插件集中营
冯立彬
冯立彬 优质创作者: 编程框架技术领域 优质创作者: 编程框架技术领域
博客等级 码龄21年 5458粉丝 593原创
评论 2
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值
⌂ 换网址