Tomcat can terminate TLS itself through its HTTPS connector. The important boundary is the server instance: its connector configuration, certificate store, runtime permissions, and application behavior must agree. A certificate placed in a Java truststore does not automatically become the identity Tomcat presents, and a working connector does not automatically update application-generated links or security constraints.
This guide uses Apache Tomcat 10.1.x, a supported JDK, the Java NIO HTTP connector, and a PKCS12 identity store. It assumes direct HTTPS on port 8443 with an existing application deployment. It does not cover a framework's embedded server, an ingress controller, or an Apache HTTP Server proxy. Review the settings against your precise Tomcat and JDK versions; the examples have not been run against a live application.
Step 1: Find the active Tomcat instance and its public identity
Identify CATALINA_BASE before editing server.xml. Machines can have several Tomcat instances sharing a binary installation while using different configuration and application directories. Editing the installation's unused example file may produce no effect, while editing a shared configuration can unexpectedly affect another service. Record the service unit or Windows service parameters that establish the instance's actual base directory.
Choose the canonical application URL, for example https://app.example.com:8443/. Confirm that intended users resolve app.example.com to the right address. The port is part of the URL but not part of the certificate SAN. A certificate for the DNS name can serve that name on 8443; it does not authenticate an IP or an unrelated machine alias used by an old bookmark.
Inventory application dependencies before changing transport. Authentication callbacks, absolute URLs, session cookies, WebSocket endpoints, and security constraints may refer to the old scheme or port. Keep a way to access the host independent of the application. If HTTPS fails to start, recovery should involve the connector configuration rather than a new application deployment or a database reset.
Back up the active server.xml, service configuration, existing stores, and deployed application configuration. Store backups outside the web application document roots so they cannot be downloaded. Capture the current connector ports and ownership of the certificate directory. Make one narrow change at a time; combining a Tomcat upgrade, JDK upgrade, and TLS rollout makes failures unnecessarily difficult to isolate.
Step 2: Issue a certificate through your existing ACME client
Precreate the hostname registration in SimpleACME and add its assigned challenge CNAME at the authoritative DNS provider. Enable paid update access before issuance. The delegated target lets the renewal client update the ACME TXT challenge without requiring broad API access to your normal DNS hosting account. The Java application does not need those challenge credentials.
Follow the public Certbot integration guide or the public win-acme guide for the platform running your renewal client. Complete scripts and configuration belong in the subscriber how-to area. Your ACME client obtains and renews the CA certificate; a separate deployment operation converts and installs it for Tomcat.
Do not look for an implied native SimpleACME connector inside Tomcat. The service boundary is DNS validation, and Tomcat's boundary is consuming a server identity. SimpleACME neither issues the certificate nor stores the application private key. Keep renewal configuration, application settings, and store passwords out of public repositories and out of logs that other application users can read.
For a private application, DNS-01 can avoid introducing a public HTTP validation endpoint. Users still need a reachable application route and trusted DNS name according to your network design. A certificate does not grant authorization or replace firewall policy. If the application is already publicly served over HTTP, plan that listener's continued role explicitly rather than assuming HTTPS automatically removes it.
Step 3: Create and inspect a PKCS12 identity store
Build the store from the private key, leaf certificate, and intermediate chain produced by the ACME client. Use a distinctive alias such as tomcat-app. Prompt for a strong store password or supply it through a reviewed secret-handling mechanism that avoids shell history. Keep the staged output separate from the active file until inspection succeeds.
umask 077
openssl pkcs12 -export -name tomcat-app \
-inkey /secure/app/privkey.pem \
-in /secure/app/cert.pem \
-certfile /secure/app/chain.pem \
-out /secure/stage/app.p12
keytool -list -v -storetype PKCS12 -keystore /secure/stage/app.p12Check that the entry is a PrivateKeyEntry and the chain is complete. A trustedCertEntry containing only the leaf is not enough for a server to prove possession of the corresponding private key. Verify SANs and validity on the leaf, then check file ownership and directory traversal access for the Tomcat service identity. A store password cannot compensate for accidentally publishing the store beside downloadable web content.
Deploy the inspected store beneath the instance's protected configuration area, such as CATALINA_BASE/conf/tls/app.p12. The exact path can differ by packaging. If a container runs Tomcat, mount the directory read-only and use the container path in configuration. Never assume the host's path is valid inside the container or that copying a symlink also copies its target.
Step 4: Add the HTTPS connector using current configuration structure
Place the connector in the intended Service element in server.xml. Preserve the rest of the instance configuration, including Engines, Hosts, Realms, and existing connectors needed by the application. The example uses an explicit SSLHostConfig and Certificate instead of mixing older flat SSL attributes with the newer structure. Replace the password placeholder using your approved protected configuration process.
<Connector port="8443"
protocol="org.apache.coyote.http11.Http11NioProtocol"
SSLEnabled="true"
scheme="https" secure="true">
<SSLHostConfig>
<Certificate certificateKeystoreFile="conf/tls/app.p12"
certificateKeystoreType="PKCS12"
certificateKeystorePassword="REPLACE_WITH_SECRET"
certificateKeyAlias="tomcat-app" />
</SSLHostConfig>
</Connector>The chosen connector is direct TLS. Proxy-specific proxyName or proxyPort settings are not needed merely because the application uses a public DNS name. If your real architecture includes a proxy, review that separate request-metadata design instead of copying this direct-listener example unchanged. The server must understand which component terminates TLS and which address the user actually sees.
Run Tomcat's configuration check through the same instance environment used by the service. Then restart using the established service manager and inspect startup logs for the connector and store errors. A generic XML parser can catch malformed tags, but it cannot establish that Tomcat can decrypt a store or bind the chosen port.
"$CATALINA_HOME/bin/catalina.sh" configtest
# Restart through your existing service manager after reviewing the result.Set CATALINA_BASE correctly before running the check. If it reports a different instance path, stop and correct the invocation rather than treating a successful check of the wrong server as approval to restart. On Windows, use the documented service configuration and equivalent script invocation for your installed layout.
Step 5: Test TLS and the application's security behavior
Probe the actual HTTPS endpoint with SNI and hostname verification. Do not use an insecure client option as your final acceptance test. A store that loads successfully can still contain the wrong certificate, an incomplete chain, or a SAN that does not match the public hostname.
openssl s_client -connect app.example.com:8443 \
-servername app.example.com -verify_hostname app.example.com \
-verify_return_error </dev/null
curl --fail --head https://app.example.com:8443/Use the application's correct context path rather than assuming it is deployed at /. Sign in with a test account and check session cookies, redirect locations, callback URLs, and any WebSocket feature. The servlet application's behavior is distinct from the connector's transport. A successful TLS handshake does not prove that a security constraint, identity-provider callback, or absolute link is correct.
If an HTTP connector remains available, decide how it should behave. Setting redirectPort on that connector supports redirection when an application security constraint requires confidential transport; it does not by itself mean every ordinary HTTP request is globally redirected. Test the intended policy explicitly and avoid claiming HTTPS is mandatory while the same sensitive application path remains usable over plain HTTP.
Check long-lived and background consumers as well as browsers. A scheduled job may use an old IP-based URL or its own JDK truststore. Identify deliberate certificate pinning and update it through its owner. Do not disable endpoint verification to preserve a hidden dependency on the previous certificate generation. Repair the identity or trust configuration that the dependency actually needs.
Step 6: Renew the store and preserve a matching rollback generation
Each successful ACME renewal must produce a new inspected PKCS12 store, not merely new PEM files in another directory. Retain its alias, store type, password policy, and file permissions. A deployment that changes the store password must update the matching protected configuration at the same time. Keep those artifacts together as a versioned operational generation.
Tomcat versions provide administrative mechanisms around SSL host configuration, but availability and invocation depend on the exact deployment. Use a planned restart unless your supported reload workflow has been deliberately verified. Do not assume overwriting a PKCS12 file automatically changes the identity used by existing or new connections. Verify a fresh TLS session after activation and compare its serial and expiry with the staged leaf.
If activation fails, restore the previous store and corresponding connector settings and restart the same instance. Keep the application deployment and database untouched. Read the specific error for alias mismatch, password failure, unreadable path, or port binding before expanding the scope of recovery. A certificate rollback should be smaller and safer than an application release rollback.
Monitor the live endpoint independently from the ACME renewal host. Alert on upcoming expiry, failed deployment, and an unexpected certificate identity. SimpleACME's TXT activity is evidence of validation work, not proof that a Java connector reloaded or an application login succeeded. Preserve those separate observations so future maintainers can locate a failure without repeating the entire rollout.
Frequently asked questions
Is importing the certificate into Java cacerts enough?
No. A truststore controls which remote certificates a Java process accepts. Tomcat needs a server identity containing its private key and certificate chain. Configure that identity in the HTTPS connector rather than treating a trusted certificate entry as a server keystore.
Why does HTTPS work while HTTP still serves the application?
The connectors and application transport policy are separate. Adding HTTPS does not automatically disable or redirect an existing HTTP connector. Review security constraints and any redirect design, then test sensitive paths over both schemes.
Can I use port 443 instead of 8443?
Yes, when your service privileges or container mapping support it. Update the canonical application URL and any callbacks accordingly. Avoid running Tomcat with unnecessary root privileges merely to bind a low port.
Why did renewal succeed but Tomcat still serves the old expiry?
The renewed PEM files may not have been converted into the deployed PKCS12 store, or the running connector may not have loaded the new store. Check conversion, deployment, activation, and a fresh network handshake as distinct stages.
Official references
Tomcat 10.1 SSL how-to describes server identity setup. Tomcat HTTP connector reference defines connector and SSL host settings. Use the matching major-version documentation for another Tomcat branch.