Skip to main content
latest version supported python versions license main branch build status develop branch build status code coverage Ruff code style black main branch documentation status develop branch documentation status

If you use Apache Tomcat for any sort of development work you’ve probably deployed lots of applications to it. There are a several ways to get your war files deployed:

Here’s another way: a command line tool and python library for managing a Tomcat server.

How Do I Use It?

This package installs a command line utility called tomcat-manager. It’s easily scriptable using your favorite shell:

$ tomcat-manager --user=ace --password=newenglandclamchowder \
http://localhost:8080/manager deploy local sample.war /sampleapp
$ echo $?
0

There is also an interactive mode:

$ tomcat-manager
tomcat-manager>connect http://localhost:8080/manager ace
Password:
--connected to http://localhost:8080/manager as ace
tomcat-manager>list
Path                     Status  Sessions Directory
------------------------ ------- -------- ------------------------------------
/                        running        0 ROOT
/sampleapp               stopped        0 sampleapp##9
/sampleapp               running        0 sampleapp##8
/host-manager            running        0 /usr/share/tomcat8-admin/host-manage
/manager                 running        0 /usr/share/tomcat8-admin/manager

And for the ultimate in flexibility, you can use the python package directly:

>>> import tomcatmanager as tm
>>> tomcat = tm.TomcatManager()
>>> r = tomcat.connect(url="http://localhost:8080/manager",
... user="ace", password="newenglandclamchowder")
>>> tomcat.is_connected
True
>>> r = tomcat.stop("/someapp")
>>> r.ok
False
>>> r.status_message
'No context exists named /someapp'

What Can It Do?

Tomcatmanager has the following capabilities, all available from the command line, interactive mode, and as a python library:

  • deploy - deploy a war file containing a tomcat application in the tomcat server

  • redeploy - remove the application currently installed at a given path and install a new war file there

  • undeploy - remove an application from the tomcat server

  • start - start a tomcat application that has been deployed but isn’t running

  • stop - stop a tomcat application and leave it deployed on the server

  • reload - stop and start a tomcat application

  • sessions - show active sessions for a particular tomcat application

  • expire - expire idle sessions

  • list - show all installed applications

  • serverinfo - show information about the server, including tomcat version, OS version and architecture, and jvm version

  • status - show server status information in xml format

  • vminfo - show diagnostic information about the jvm

  • threaddump - show a jvm thread dump

  • resources - show the global jdni resources configured in tomcat

  • findleakers - show tomcat applications that leak memory

  • sslconnectorciphers - show tls ciphers configured for each connector

  • sslconnectorcerts - show tls certificate chain for each virtual host

  • sslconnectortrustedcerts - show trusted certificates for each virtual host

  • sslreload - reload tls certificate and key files

Documentation

Complete documentation for the last released version is available at http://tomcatmanager.readthedocs.io/en/stable/. It includes material showing how to use tomcat-manager from the command line or using interactive mode. There is also a walkthrough of how to use the API and an API reference.

Documentation is also built from the develop branch, and published at https://tomcatmanager.readthedocs.io/en/latest/. The develop branch may not yet be released to PyPi, but you can see the documentation for what’s coming up in the next release.

Installation

You’ll need Python >= 3.8. Install using pip:

$ pip install tomcatmanager

Works on Windows, macOS, and Linux.

Works with Tomcat >= 8.5 and <= 10.1.

Tomcat Configuration

This library and associated tools do their work via the Tomcat Manager web application included in the Tomcat distribution. You will need to configure authentication in tomcat-users.xml with access to the manager-script role:

<tomcat-users>
  ...
  <role rolename="manager-script"/>
  <user username="ace" password="newenglandclamchowder" roles="manager-script"/>
  ...
</tomcat-users>

Metadata

Release files for tomcatmanager 7.0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for tomcatmanager 7.0.1
File Size Uploaded
tomcatmanager-7.0.1.tar.gz 134.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for tomcatmanager 7.0.1
File Interpreter ABI Platform
tomcatmanager-7.0.1-py3-none-any.whl Python 3 none any Details

Total release size: 187.3 kB

Release files / tomcatmanager-7.0.1.tar.gz

Download URL tomcatmanager-7.0.1.tar.gz
Size 134.6 kB
Tags Source
SHA-256 checksum
How to use checksums
02f1b8e5dc1b10a94ffa0cef27373616d0fd41a3fe658d71481bdada8f3faa43
BLAKE2b-256 checksum
How to use checksums
1f65d93427def594263cc132ce7a8bcf4192fe020648319a4eab9f8dc61b34b7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.12.0

Release files / tomcatmanager-7.0.1-py3-none-any.whl

Download URL tomcatmanager-7.0.1-py3-none-any.whl
Size 52.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
1b06c7cf8c34f3b3220a0f7da4eb11467157aa4751f6344ab6cfefb98f21f69d
BLAKE2b-256 checksum
How to use checksums
5e602c970ab672bc9122d8c1ab192efb08e4137d3ad09fb992ae9e6cc0192a74
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.12.0

Release history Release notifications | RSS feed

This release

7.0.1 This release

2 release files

7.0.0

2 release files

6.0.1

2 release files

6.0.0

2 release files

5.0.0

2 release files

4.0.0

2 release files

3.0.0

2 release files

2.0.0

2 release files

1.0.2

2 release files

1.0.1

2 release files

1.0.0

2 release files

0.14.0

2 release files

0.12.0

2 release files

0.10.0

2 release files

0.9.2

2 release files

0.9.1

2 release files

0.9.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page