从上载的(uploaded)WAR文件内,把新的web程序部署到指定的context path上去。
Deploy a new web application, on a specified context path, from the server file system.
列出当前部署的web程序,以及这些web程序的活跃着的sessions。
重新装载现有的web程序,以反映出/WEB-INF/classes 或 /WEB-INF/lib 里内容的更改。
列出OS和Java虚拟器(JVM)属性值(property values)。
列出可使用的全球性JNDI资源, 供给正在准备<ResourceLink>;套嵌在<Context> 的元素;部署描述的开发工具使用。
列出用户数据库里定义的可用安全性功能。
启动运行一个被停止了的程序(让它可再被使用)。
停止一个现有的程序(这样它就变成不可被使用),但是不undeploy它。
Undeploy a deployed web application and delete its document base directory (unless it was deployed from file system).
有两种方式来配置Manager网络应用程序Context:
<!-- Link to the user database we will get roles from -->
<ResourceLink name="users" global="UserDatabase"
type="org.apache.catalina.UserDatabase"/>
没有指定上下文路径
路径参数是必需的。
在path /foo上部署的WAR文件不支持重新装载
目前,当网络程序从一个WAR文件直接被部署时,程序的重新装载(拾起classes 或 web.xml文件里的更改)就不被支持。重新装载仅仅适用于那些从未包装目录那里部署的程序。如果你在使用WAR文件,要拾起(pick up)那些更改,你应该先undeploy(旧的文件),然后再deploy这个程序,或者以update的参数来部署这个程序。
List OS and JVM Properties
OK - Listed security roles
然后是每一行对应一个安全性能。每一行由以冒号(":")为界限的如下区域组成:
安全性能名称(Security Role Name)——用户数据库里Tomcat所知道的安全性能名称。
描述(Description)——关于这个安全性能的描述(对于产生选定功能的用户界面有用)
如果出现错误,回应(response)将是以FAIL开头的一段错误消息。产生错误的可能原因包括:
Cannot resolve user database reference —— 一个JNDI错误,阻止了成功查询org.apache.catalina.UserDatabase 资源。关于这类错误,请查看Tomcat log 文件的stack trace 。
No user database is available —— 你还没有为用户资源配置一个可以指向适当的用户数据库实例(instance)的资源索引。检查一下你的manager.xml文件,确保你为这个资源产生了一个适合的<ResourceLink>或<ResourceParams>元素。
<!-- 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>
ant -Dpassword=secret deploy
Tasks output capture
使用Ant 1.6.2或其后版本,Catalina tasks在属性文件或外部文件里提供捕捉它们的输出信息的选项。 它们直接支持下列<redirector>类型attributes的下属属性:
属性 描述 是否必要
output 向其进行输出的文件名。如果error stream没有被重新指向一个文件或属性,那么它就出现在这里。 No
error 标准的错误信息输出命令应该指向这个文件。 No
logError This 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
append 输出和错误文件是否应该被附加上或被overwritten。默认设置是false。 No
createemptyfiles 即使在输出和错误文件是empty时,它是否应该被产生。默认设置是true。 No
outputproperty The 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
errorproperty The 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:
属性 描述 是否必要
alwaysLog This 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.3 No
failonerror This 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:
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
JMX Proxy Servlet是用来获取和设置Tomcat内部组织的轻型代理。(或者任何通过MBean被exposed过的类)。 它的用法对客户来说不方便,但是它的UI对于整合命令行scripts来监督和改变Tomcat内部组织很有帮助。你可以用代理来做两件事:获取信息和设置信息。你必须对JMX有个基本了解才能真正理解JMX Proxy Servlet。如果你不知道JMX是什么,那你就会感到迷惑。
JMX Query command
以这种形式: