'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



Solution 1:[1]

  1. Please explain about this new term Jakarta like how does this come into the picture?

Oracle maintained Java EE, on September 2017 Oracle Announced that Java EE will be submitted to Eclipse Foundation. "Java" is a trademark owned by Oracle so "Java EE" renamed to "Jakarta EE".

  1. is this the only way to use Jakarta APIs to upgrade servlet 5.0. can we use old 'javax.servlet-api' ?
  2. 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

The first release of Jakarta EE 8 which include Servlet 4.x and it is compatible with Java EE 8. Both Java EE 8 and Jakarta EE 8 uses javax.* namespace.

It doesn't matter which one you are using both will work each other.

what are the other things need to be required to upgrade servlet 4.0 to servlet 5.0?

To upgrade to Servlet 5.0, you must use Jakarta EE 9. From Jakarta EE 9 the namespace is changed from javax.* to jakarta.* so you must change all javax.* packages imports to jakarta.* packages.

Also, if you are using any other libraries, you must use compatible version.

The maven dependency for Jakarta EE Web API is the following.

<dependency>
    <groupId>jakarta.platform</groupId>
    <artifactId>jakarta.jakartaee-web-api</artifactId>
    <version>9.1.0</version>
    <scope>provided</scope>
</dependency>

REF: GitHup Template for Jakarta EE 9 Web

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1