Tomcat Upgrade from 9.x to 10.1.x (Linux)

This article outlines a systematic procedure for upgrading Apache Tomcat from version 9.0.x to 10.1.x on a Linux environment. Following these steps ensures application availability, minimizes downtime, and maintains configuration integrity. The process includes backing up existing configurations, upgrading Tomcat, reapplying critical settings, deploying application artifacts, and validating the environment after the upgrade.

Prerequisites

Before beginning the upgrade, ensure the following:

  • Administrator (root or sudo) privileges on the Linux server.

  • Java 17 is installed and configured as the default Java runtime.

  • Existing Tomcat installation is healthy and currently running without critical errors.

  • Sufficient disk space for backups and the new installation package.

  • Network access to download the latest Tomcat package or access to the pre-shared package provided by the OvalEdge team.

Upgrade Procedure

  1. Stop Tomcat Services and Backup Existing Installation

    • Stop the Tomcat service:

      sudo systemctl stop tomcat

      Sample Reference Screenshot:

    • Create a backup directory:

      mkdir -p /opt/tomcat_backup
    • Copy the current Tomcat installation to the backup location:

      cp -r /opt/tomcat /opt/tomcat_backup/tomcat_$(date +%F)

  1. Download the Latest Tomcat Release

    • Official download site: Apache Tomcat Archives

    • Obtain Tomcat 10 Latest tarball:

      wget https://archive.apache.org/dist/tomcat/tomcat-10/v10.1.40/bin/apache-tomcat-10.1.40.tar.gz

      Sample Reference Screenshot:

  2. Extract Tomcat

    • Extract the package into /opt:

      tar -xvf apache-tomcat-10.1.40.tar.gz -C /opt
      mv /opt/apache-tomcat-10.1.40 /opt/tomcat

      Sample Reference Screenshot:

  3. Migrate setenv.sh

    • Copy the setenv.sh file from the previous installation:

      cp /opt/tomcat_backup/tomcat_*/bin/setenv.sh /opt/tomcat/bin/

      Sample Reference Screenshot:

      For Release 72, additional parameters must be added to setenv.sh. Refer to the extprop configuration document or updates from the OvalEdge team for further information.

  4. Deploy OvalEdge WAR and Third-Party JARs

    • Obtain the OvalEdge Release 72 WAR file from the team.

    • Deploy the WAR file to the webapps directory:

      cp /path/to/ovaledge.war /opt/tomcat/webapps/
    • Replace third-party JARs:

      • Backup existing JARs:

        cp -r /opt/tomcat/third_party_jars /opt/tomcat_backup/third_party_jars_$(date +%F)
      • Replace 6.3.4 JARs with the Release 72 JARs provided by OvalEdge.

  5. Configure server.xml

    • Review and update /opt/tomcat/conf/server.xml:

      • Ensure startup/shutdown ports and SSL configurations are correctly set.

      • Enable compression by adding the connector:

      <!-- Comment out the default Connector -->
      <!--
      <Connector port="8080" protocol="HTTP/1.1"
                 connectionTimeout="20000"
                 redirectPort="8443" />
      -->
      
      <!-- Add Compression-enabled Connector -->
      <Connector connectionTimeout="20000" port="8080" protocol="HTTP/1.1" redirectPort="8443"
                 compression="on" useSendfile="false"
                 noCompressionUserAgents="gozilla, traviata"
                 compressableMimeType="text/html,text/xml,text/plain,text/css,text/javascript,application/javascript"/>

      Sample Reference Screenshots:

  6. Configure context.xml

    • Add caching to /opt/tomcat/conf/context.xml:

      <Resources cacheMaxSize="102400" />

      Sample Reference Screenshot:

    • Save and close the file.

  7. Update Tomcat Service Configuration

    • Edit the Tomcat systemd service file (/etc/systemd/system/tomcat.service) to reflect the new installation path (/opt/tomcat).

    • Reload systemd to apply changes:

      sudo systemctl daemon-reload

      Sample Reference Screenshot:

  8. Start Tomcat Service

    • Start Tomcat:

      sudo systemctl start tomcat

      Sample Reference Screenshot:

    • Enable auto-start at boot:

      sudo systemctl enable tomcat

Testing and Verification

  • Access the application via browser at the configured URL.

  • Validate that the OvalEdge application functions as expected.

  • Monitor Tomcat logs for errors or warnings (logs/catalina.out, logs/catalina.YYYY-MM-DD.log, etc.):

    tail -f /opt/tomcat/logs/catalina.out

    Sample Reference Screenshot:

  • Check rotated logs for startup errors:

    /opt/tomcat/logs/catalina.YYYY-MM-DD.log

Rollback Procedure

  • If issues occur during or after the upgrade:

    • Stop the new Tomcat service:

      sudo systemctl stop tomcat
    • Restore the previous Tomcat backup:

      rm -rf /opt/tomcat
      cp -r /opt/tomcat_backup/tomcat_<backup-date> /opt/tomcat
    • Reload systemd and restart Tomcat:

      sudo systemctl daemon-reload
      sudo systemctl start tomcat
    • Validate application functionality using the restored version.


Copyright © 2025, OvalEdge LLC, Peachtree Corners, GA, USA.

Last updated

Was this helpful?