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 application 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 will 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
|
|
|
|
|
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 using the war file name without the .war extension as the path. The application can later be undeployed (and the corresponding application directory removed) by use of the /undeploy . To deploy the ROOT web application (the application with a context path of "/"), name the war ROOT.war.
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.
|
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. 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 the context path used is 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 /bar .
|
|
|
|
http://localhost:8080/manager/deploy?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 Tomcatserver.xml configuration file. Here is an example:
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=file:/path/bar.war&path=/bar
|
|
|
|
|
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 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 specified 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 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.
|
Server Status |
From this link , you can view information about the server.
First, you have the server and JVM version number, JVM provider, OS name and number followed by the architecture type.
Second, there is several information about the memory usage of the JVM (available, total and max memory).
Then, there is information about the Tomcat AJP and HTTP connectors. The same information is available for both of them :
-
Threads information : Max threads, min and max spare threads, current thread count and current thread busy.
-
Request information : Max processing time and processing time, request and error count, bytes received and sent.
-
A table showing Stage, Time, Bytes Sent, Bytes Receive, Client, VHost and Request. All existing threads are listed in the table. Here is the list of the possible thread stages :
-
"Parse and Prepare Request" : The request headers are being parsed or the necessary preparation to read the request body (if a transfer encoding has been specified) is taking place.
-
"Service" : The thread is processing a request and generating the response. This stage follows the "Parse and Prepare Request" stage and precedes the "Finishing" stage. There is always at least one thread in this stage (the server-status page).
-
"Finishing" : The end of the request processing. Any remainder of the response still in the output buffers is sent to the client. This stage is followed by "Keep-Alive" if it is appropriate to keep the connection alive or "Ready" if "Keep-Alive" is not appropriate.
-
"Keep-Alive" : The thread keeps the connection open to the client in case the client sends another request. If another request is recieved, the next stage will br "Parse and Prepare Requst". If no request is received before the keep alive times out, the connection will be closed and the next stage will be "Ready".
-
"Ready" : The thread is at rest and ready to be used.
|
|