Update to Jetty 11, Tomcat 10 with jakarta.* instead of javax.*

In the latest updates moqui-framework is now using Jetty 10 which is backward compatible with the Java Servlet 4 API, and other APIs (websocket, etc) that use the javax.* package prefix.

The Java Servlet 5.0 and Websocket 2.0 APIs change the package name from javax to jakarta. This is unfortunate for backward compatibility reasons.

It seems this is the course of the future for Java Enterprise Edition, which is basically not a thing going forward and it is now Jakarta Enterprise Edition. This happened when Oracle donated all of Java EE to the Eclipse Foundation. The official web site is here:

On a side note, to make things more confusing there is also an Apache Jakarta project which is something different (though was similar in terms of technical domain) and was retired over a decade ago (see https://jakarta.apache.org).

Apache Tomcat has a good summary of the updates to the different APIs for Tomcat version 10: Apache Tomcat® - Migration Guide - Tomcat 10.0.x

Jetty has some information about specification versions and Jetty versions here: The Eclipse Jetty Project :: Eclipse Jetty

Because this seems to be the way forward for these specifications that Moqui uses (and pretty much all other Java based web applications), it is a question of when and not if we make the leap.

The downside to it is once the update is done Moqui will no longer run on older versions of servlet containers and application servers. For Jetty this means once we move to the jakarta.* packages and Jetty 11 then it will no longer run on Jetty 9 or 10. For Apache Tomcat it means that Tomcat 9 and earlier will no longer be supported and Tomcat 10 will be required.

After researching it more my thought is we should do this sooner than later, along with other recent changes that are not backward compatible (to Java 11, Spock & JUnit, etc).

If no one is concerned about this I’ll do it in the near future, so please comment with thoughts and concerns!

A first pass on changes for this is in the ‘jetty11’ branch of moqui-framework:

So far there is one big issue: the shiro-web library uses the javax.servlet API and needs to be updated. There may be other libraries like this that moqui-framework or other components depend on.

While it might be nice to handle this transition sooner than later, we may be limited by third party libraries that also need the update.

This seemed like a bit of a mess and inconvenience at first, now that I think about it more with all of the possible libraries that anyone might be using that also depend on javax.servlet vs jakarta.servlet packages (and similar for websocket, etc)… it’s a huge mess that could take years to resolve and involve multiple versions of various libraries like Jetty 10 and 11. What a disaster!

Can we transform the third party library.
There’s some tools focus on this task.

1 Like

That’s an interesting idea, maybe a way to go about this… looks like the Hibernate folks built a gradle wrapper for this for their use:

After some discussion on the call last Friday and more consideration since then, IMO we should hold off on the update to use the jakarta.* packages instead of the javax.* packages, and for now stick to Jetty 10, Tomcat 9, etc that are still being maintained with the javax packages.

At some point in the future this will change, but there are no considerable improvements in the updated Servlet/etc specs yet. For example the Servlet 6.0 spec is coming up, so maybe once that is out and supported in various app servers (at least Jetty, Tomcat, maybe some others).