Tomcat – Upgrading Tomcat 7.0 – 8.5 or 9.0

tomcat

I've recently inherited a system running Tomcat 7.0.68 and discovered that Tomcat 7 will reach end of life in March of 2021. I also learned that Tomcat 8.0 appears to have been superseded by both Tomcat 8.5 and 9.0, which seems confusing to me. Which is the recommended upgrade candidate? Are there pros and cons for one versus the other? I am currently running Java 1.8.0_74 but have later versions of Java 8 in use throughout our infrastructure. The web application we are running is THREDDS v4.6.10. Any recommendations or suggestions would be appreciated.

Best Answer

There isn't a lot of difference between Tomcat 8.5 and 9.0: the former started as a fork of the first pre-release versions of Tomcat 9.0. Since the big changes in Java EE Servlet API came with version 3.0 (which is supported by Tomcat 7.0) I don't foresee any major problems with the migration to a newer Tomcat release.

I would choose Tomcat 9.0, since it is the "last version you'll ever need", meaning that Tomcat 10.0 will use a binary incompatible standard Jakara EE Servlet 5.0 (basically they renamed the packages from javax.servlet to jakarta.servlet), so I think that Tomcat 9.0 will be around for a very long time.

Some things to take in mind during migration:

  • setup a test server first, things like to break in unexpected ways,
  • stick with Java SE 8.0, since it will be supported at least until May 2026 and because newer versions lack many Java EE APIs, which your applications may rely on (most notably JAXB),
  • if you use a container managed connection pool, Tomcat 7.0 used commons-dbcp, while Tomcat 8.0+ uses commons-dbcp2, so you may want to tweak the connection pool parameters,

You don't mention the system you run Tomcat on. If you use Windows, I've seen many clients make the mistake to install a 32-bit Java (it's the first result you find on Google), which limits the available memory to around 2 GiB.

Related Topic