Updating Tomcat

Apache Tomcat should be kept up to date so that the server continues to receive security fixes. Tomcat releases new patch versions regularly, and applying them is a routine maintenance task rather than an iGene upgrade.

This guide installs the new version into a new folder alongside the existing one. That takes a little longer than replacing files in place, but it means the working installation is untouched and rolling back is simply a matter of pointing the service back at it.

Before You Start

  • Agree a maintenance window. iGene will be unavailable while the service is stopped.
  • Confirm you have administrator access to the server.
  • Record the current configuration, as described below.

Record the Current Version

Open a command prompt and run:

C:\path\to\tomcat\bin\version.bat

Make a note of the version reported.

Record the Service Settings

Open the service configuration tool:

C:\path\to\tomcat\bin\iGenew.exe

Take a screenshot of each tab, paying particular attention to:

  • The Java tab, especially the memory settings and any Java options. iGene relies on these being set correctly, and they are not carried over automatically.
  • The General tab, especially the service name and the startup type.
  • The Log On tab, which shows the account the service runs as. If it runs as a named account rather than a system account, that account needs access to the iGene home folder.

Your Backup Is the Existing Installation

Because the new version goes into a separate folder, the existing Tomcat installation is left intact and is itself the rollback. There is no need to take a separate copy of it.

Everything that is copied out of it during this update is read only, so the old folder still contains a complete, working Tomcat with iGene in it and all of its configuration.

The one part of the old installation that is not protected this way is the Windows service configuration, because those settings are held against the service rather than in the folder. That is what the screenshots above are for.

A database backup is not required for a Tomcat update, because nothing in the database changes. Take one anyway if your local change process calls for it.

Download the New Version

Download the latest Apache Tomcat 9 release, using the ZIP distribution.

Download from: https://tomcat.apache.org/download-90.cgi

Extract to a New Folder

Extract the download to a new folder alongside the existing installation, naming the folder after the version you are installing:

C:\path\to\apache-tomcat-9.0.122

The ZIP already contains a folder named this way, so extracting it into the folder that holds the current installation will normally produce the right name without you doing anything.

Do not extract it over the top of the existing folder.

The rest of this page uses C:\path\to\apache-tomcat-9.0.122 to mean the new installation and C:\path\to\tomcat to mean the existing one. Substitute your own paths.

Stop Tomcat

net stop iGene

Alternatively, open Services, find the iGene service and stop it there. Wait until it has fully stopped before continuing.

Carry Across Your Configuration

Copy the following from the old installation into the new one.

iGene Itself

Copy the application into the new webapps folder:

webapps\ROOT.war

There is no need to copy webapps\ROOT\. Tomcat recreates that folder automatically when the application starts.

The iGene Context File

This one is essential. iGene is told where its home folder is by a Tomcat context file:

conf\Catalina\localhost\ROOT.xml

It contains a single parameter pointing at the iGene home folder, and looks like this:

<Context>
    <Parameter name="igene_home" value="D:\igene_home" override="true" />
</Context>

Copy this file into the same location under the new installation, creating the Catalina\localhost folders if they do not already exist.

Other Configuration Files

Copy across any other files that were customised for this installation, typically:

  • conf\server.xml if ports, connectors or the shutdown port were changed
  • conf\context.xml if it was edited for this installation
  • bin\setenv.bat if one was created for this installation

Remove the Old Service

Open a Command Prompt as Administrator and run, using the service name you recorded earlier:

C:\path\to\tomcat\bin\service.bat remove iGene

Update the Environment Variables

If CATALINA_HOME or CATALINA_BASE are set on this server, update them to point at the new folder before installing the service below, otherwise the new service installs against the old paths:

CATALINA_HOME=C:\path\to\apache-tomcat-9.0.122
CATALINA_BASE=C:\path\to\apache-tomcat-9.0.122

Install the New Service

Still in the Administrator Command Prompt, run:

C:\path\to\apache-tomcat-9.0.122\bin\service.bat install iGene --rename

Re-apply the Service Settings

Open the service configuration tool from the new folder:

C:\path\to\apache-tomcat-9.0.122\bin\iGenew.exe

Using the screenshots you took earlier, re-enter:

  • The memory settings and Java options on the Java tab
  • The startup type on the General tab
  • The service account on the Log On tab, if it was not a system account

Click Apply, then OK.

Start Tomcat

net start iGene

Allow sufficient time for iGene to deploy and start.

Validate

  1. Confirm Tomcat is responding:

    http://<server>:8080
    
  2. Open iGene in a web browser.

  3. Log in with a valid user account.

  4. Carry out a quick functional check to confirm the application is operating correctly.

  5. Confirm the new version is running:

    C:\path\to\apache-tomcat-9.0.122\bin\version.bat
    

Roll Back (if needed)

Because the previous installation is still on disk and untouched, rolling back means pointing the service back at it:

  1. Stop the Tomcat service.
  2. Open an Administrator Command Prompt and remove the new service:

    C:\path\to\apache-tomcat-9.0.122\bin\service.bat remove iGene
    
  3. If CATALINA_HOME or CATALINA_BASE were changed during the update, set them back to the old folder now, before reinstalling, otherwise the reinstalled service picks up the new paths.

  4. Reinstall the service from the old folder, using the original service name:

    C:\path\to\tomcat\bin\service.bat install iGene --rename
    
  5. Re-apply the service settings from your screenshots.

  6. Start the service and confirm iGene is operating correctly.

Tidy Up

The old Tomcat folder is your rollback, so keep it until you are confident the update has held. Once the new version has been running without problems for an agreed period, it can be deleted. Keeping it until the next maintenance window is a reasonable precaution.