Is it possible to use tomee with a newer version of tomcat than it was shipped with?

977 Views Asked by At

I'm maintaining a legacy server built on Tomee. Tomee releases lag behind the tomcat releases by a few months. We need to adhere to strict security policies in my company and even the most recent Tomee versions are raising security flags for having unpatched security problems.

Is there a way to use tomee with all its managed dependencies but to override the tomcat version for deploy?

The deploy environment is via docker, so ideally I would just add a few lines to the dockerfile to pull a newer tomcat and overwrite the one that tomee uses. Is that as easy as it sounds or is there some kind of trick?

1

There are 1 best solutions below

0
On BEST ANSWER

Basically, you need to adhere to the following convention:

  • Tomcat 10.0.x -> TomEE 9.0.X (EE 9)
  • Tomcat 9.0.x -> TomEE 8.0.x (EE 8)
  • Tomcat 8.0.x -> TomEE 7.x.x (EE 7)

Switching between Tomcat major versions is not easy possible. Patching minor Tomcat version updates in the corresponding TomEE release - however - is possible.

However, sometimes it is necessary to replace certain classes within a Tomcat distribution to build a full TomEE distribution from scratch. You can check the details in the related Maven build file. In addition, some other files and properties are "bootstrapped" too. The relevant content is contained in Installer.java and in the related web.xml.

If I would need to patch a Tomcat's version and the release cycle would be too slow for my needs, I would go the following path:

  1. Check out the latest release tag
  2. Modify the version of Tomcat in the parent POM
  3. Conduct a build from scratch mvn clean install -Dskip.tests=true (requires Java 8 + Maven)
  4. Grab the latest TAR.GZ / ZIP from the target folder of tomee/apache-tomee/.
  5. Put that into my container. 1.) to 4.) could possibily conducted in a separate docker build image / container and then transferred to the target container build.

Alternative

You can also use the drop-in TomEE webapp to "upgrade" a Tomcat to a TomEE. However, there is a known limitation: If your webapp starts before the "tomee" webapp, the integration will have to do a separate undeploy/redeploy of your webapp which is clunky. In addition, some "magic" is required to load the tomee webapp's contents into the Tomcat server classloader. From current mailing list discussions, this webapp will be retired in the near future.