# Multiple Tomcat instances on Windows with CATALINA_BASE

> Share one Tomcat install, create isolated CATALINA_BASE directories, change ports, and register each instance as its own service.

**Tested on**

- Build: 26100.33650
- Edition: Standard / Datacenter
- Architecture: x64
- Evidence: E1
- Verified: 2026-10-29

## The short answer

`CATALINA_HOME` is the Tomcat binaries. `CATALINA_BASE` is one instance’s config, logs, webapps and work.

Run two instances from one install:

```text
C:\tomcat\            CATALINA_HOME
C:\tomcat\instances\a CATALINA_BASE
C:\tomcat\instances\b CATALINA_BASE
```

Each base has its own `conf/server.xml` with different ports.

## Create an instance

```powershell
$home = 'C:\tomcat'
$base = 'C:\tomcat\instances\a'
New-Item -ItemType Directory -Force $base\conf,$base\logs,$base\temp,$base\webapps,$base\work | Out-Null
Copy-Item "$home\conf\*" "$base\conf" -Recurse -Force
```

Do not copy `logs`/`work` content; create empty directories. Copy `conf` as the starting point, then edit.

## Ports

In `C:\tomcat\instances\a\conf\server.xml`:

```xml
<Server port="8005" shutdown="SHUTDOWN">
  <Connector port="8080" protocol="HTTP/1.1" connectionTimeout="20000" />
  <Connector port="8009" protocol="AJP/1.3" secretRequired="true" />
</Server>
```

For instance B use `8006`, `8081`, `8010` (or disable AJP if unused). Every port must be unique across instances: shutdown, HTTP, AJP, redirect.

## Start an instance

```bat
set "CATALINA_HOME=C:\tomcat"
set "CATALINA_BASE=C:\tomcat\instances\a"
C:\tomcat\bin\catalina.bat run
```

For services, register each base separately. With the Tomcat service manager, use a distinct service name and point it at the base; do not register the same service twice. Verify:

```powershell
Get-CimInstance Win32_Process -Filter "Name='java.exe'" |
  Select-Object ProcessId, CommandLine
Invoke-WebRequest http://localhost:8080/ -UseBasicParsing | Select-Object StatusCode
Invoke-WebRequest http://localhost:8081/ -UseBasicParsing | Select-Object StatusCode
```

`-Dcatalina.base=...` in the command line proves which base each JVM uses.

## Deploy and isolate

- Put each app in its own `webapps` or deploy a context XML pointing at an external path.
- Keep `logs`, `temp`, `work` per base.
- Do not share a JDK unless intended; pin `JAVA_HOME` per instance (see Java multi-version).
- One instance crashing should not take the other’s ports or logs.

> **Caution: Copying the whole Tomcat folder is not multi-instance**
>
> Two full copies work but waste disk and drift on upgrades. One `CATALINA_HOME` + separate `CATALINA_BASE` is the supported multi-instance model.

## Lab boundary

E1. The lab did not install Tomcat; the layout and commands are the multi-instance procedure to verify on Server 2025.

## Sources

- [Apache Tomcat — RUNNING](https://tomcat.apache.org/tomcat-10.1-doc/RUNNING.txt)
- [Apache Tomcat — Windows service](https://tomcat.apache.org/tomcat-10.1-doc/windows-service-howto.html)
- [Apache Tomcat — Configuration](https://tomcat.apache.org/tomcat-10.1-doc/config/)

---

Source: https://winbook.fyi/en/server/runtimes/tomcat-instances/
