Skip to content
Advertisement

upgrade servlet 4.0.1 to servlet 5.0

I am upgrading servlet 4.0.1 to servlet 5.0. I was using below maven dependency for servlet 4.0.1

<dependency>
        <groupId>javax.servlet</groupId>
        <artifactId>javax.servlet-api</artifactId>
        <version>4.0.1</version>
        <scope>provided</scope>
</dependency> 

When I am upgrading to servlet 5.0 then I see that There is a new term ‘Jakarta’ and servlet5 comes with Jakarta API with below maven dependency.

<dependency>
  <groupId>jakarta.servlet</groupId>
  <artifactId>jakarta.servlet-api</artifactId>
  <version>5.0.0</version>
</dependency>

So, there are below questions I tried to search on the internet but couldn’t find

  1. Please explain about this new term Jakarta like how does this come into the picture?
  2. is this the only way to use Jakarta APIs to upgrade servlet 5.0. can we use old ‘javax.servlet-api’ ?
  3. I see, Jakarta was also there in the 4.0 version but we were not using it. does it not having any dependency with servlet 4. ? https://mvnrepository.com/artifact/jakarta.servlet/jakarta.servlet-api
  4. what are the other things need to be required to upgrade servlet 4.0 to servlet 5.0?

Please also suggest any docs for reference if any

Advertisement

Answer

Servlet spec

You said:

I am upgrading servlet 4.0.1 to servlet 5.0.

No, that is not actually an « upgrade ».

There is no significant change in the Servlet spec between 4.0 and 5.0, other than moving from javax.* to jakarta.* package naming.

This change in namespace is one phase in the transition of Oracle Corp transferring responsibility for Java EE technologies to the Eclipse Foundation, becoming Jakarta EE.

You will not benefit from any new features or improvements by moving to Servlet 5 from Servlet 4.

In contrast, Jakarta Servlet 6 does bring signifiant changes and improvements.

Jetty

You commented:

The main reason for upgrading to servlet 5.0 is Jetty11. because this is Jetty11’s prerequisite.

Jetty 10 is the same as Jetty 11, but for the change in package name from javax.* to jakarta.*. The two versions are developed in parallel. There are no better features or improvements to be found in Jetty 11 over Jetty 10.

(By the way, ditto for Apache Tomcat 9.x and Tomcat 10.0, parallel versions for package naming change.)

👉 If you want to be conservative for now, stick with Jetty 10 and the javax.* package naming. If you want to prepare for the future, use Jetty 11 and jakarta.* package naming.


There are many articles, presentations, and interviews about the transition with Oracle Corp handing control of Java EE to the Eclipse Foundation, and the accompanying name change to Jakarta EE. You really should do some basic industry research on this Oracle-to-Jakarta topic, to understand the changes. Start with Wikipedia.

User contributions licensed under: CC BY-SA
9 People found this is helpful
Advertisement