设为首页 收藏本站
查看: 711|回复: 0

[经验分享] Tomcat帮助文档翻译(未完成)

[复制链接]

尚未签到

发表于 2017-1-30 09:28:08 | 显示全部楼层 |阅读模式
  偶也是学习,不过,觉得每次都是读英文,麻烦,就希望把它翻译成中文,为自己,也为其它想学习的朋友,呵呵.
不过,由于内容比较多,可能翻译的时间要多一点,如果有兴趣合作的朋友,可以回复BLOG,留言您想翻译那一段.
让我们一起完成该内容.
  不过,为了增加文档的可阅读性,把阅读当成一种享受,请在翻译的时候遵守以下几点:
  1).翻译的字体一律用绿色.保证阅读不那么伤眼睛.
  2).重点标题用红色标明,重点内容用蓝色标注.


<!--PAGE HEADER-->


<!--JAKARTA LOGO--> DSC0000.gif

<!--HEADER SEPARATOR-->


<!--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:
  这里有两种方式配置管理应用程序环境:


  • 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 (<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:
    [table]

<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

    [table]

    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

    [table]

    http://localhost:8080/manager/resources[?type=xxxxx]


  • 运维网声明 1、欢迎大家加入本站运维交流群:群②:261659950 群⑤:202807635 群⑦870801961 群⑧679858003
    2、本站所有主题由该帖子作者发表,该帖子作者与运维网享有帖子相关版权
    3、所有作品的著作权均归原作者享有,请您和我们一样尊重他人的著作权等合法权益。如果您对作品感到满意,请购买正版
    4、禁止制作、复制、发布和传播具有反动、淫秽、色情、暴力、凶杀等内容的信息,一经发现立即删除。若您因此触犯法律,一切后果自负,我们对此不承担任何责任
    5、所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其内容的准确性、可靠性、正当性、安全性、合法性等负责,亦不承担任何法律责任
    6、所有作品仅供您个人学习、研究或欣赏,不得用于商业或者其他用途,否则,一切后果均由您自己承担,我们对此不承担任何法律责任
    7、如涉及侵犯版权等问题,请您及时通知我们,我们将立即采取措施予以解决
    8、联系人Email:admin@iyunv.com 网址:www.yunweiku.com

    所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其承担任何法律责任,如涉及侵犯版权等问题,请您及时通知我们,我们将立即处理,联系人Email:kefu@iyunv.com,QQ:1061981298 本贴地址:https://www.yunweiku.com/thread-335175-1-1.html 上篇帖子: tomcat 7 应用不能访问 及 配置管理界面 下篇帖子: 嵌入式Tomcat用于在Eclipse中调试
    您需要登录后才可以回帖 登录 | 立即注册

    本版积分规则

    扫码加入运维网微信交流群X

    扫码加入运维网微信交流群

    扫描二维码加入运维网微信交流群,最新一手资源尽在官方微信交流群!快快加入我们吧...

    扫描微信二维码查看详情

    客服E-mail:kefu@iyunv.com 客服QQ:1061981298


    QQ群⑦:运维网交流群⑦ QQ群⑧:运维网交流群⑧ k8s群:运维网kubernetes交流群


    提醒:禁止发布任何违反国家法律、法规的言论与图片等内容;本站内容均来自个人观点与网络等信息,非本站认同之观点.


    本站大部分资源是网友从网上搜集分享而来,其版权均归原作者及其网站所有,我们尊重他人的合法权益,如有内容侵犯您的合法权益,请及时与我们联系进行核实删除!



    合作伙伴: 青云cloud

    快速回复 返回顶部 返回列表