A Smooth Transition to Tomorrow: Unveiling the Upgrade Adviser Tool for Jakarta EE 10

Photo of Alfonso Altamirano by Alfonso Altamirano

One of the most daunting tasks organizations face is keeping pace with fast evolving technological landscapes, while ensuring existing applications remain robust and functional. If you're still running applications on Java EE 7/8,  the release of Jakarta EE 10 sets the upgrade clock ticking. Of course you can keep running such applications with a Payara Enterprise 5 plan. However, if you need to upgrade to take advantage of the many new features in Jakarta EE 10, then read on!

Payara 6 CommunityandPayara 6 Enterpriseare ready for use with Jakarta EE 10. 

However, in order reduce disruptions to operations, the upgrade to Jakarta EE 10 should be carried out with as little downside as possible. How do you identify what changes need to be made to your existing applications? How do you ensure that these changes won't break existing functionality or introduce new bugs? And how can you possibly execute this transition efficiently when your development team is already stretched thin?

Your first attempt at upgrading to Jakarta EE 10 would be to

This can be very challenging, but it is the normal behaviour to follow to upgrade an older application to Jakarta 10. However, it would be a big productivity boost if you could identify upfront what possible challenges the upgrade process could present. Enter the Payara Upgrade Advisor Tool.

What is the Upgrade Advisor Tool?

The Payara Upgrade Advisor Tool is a Maven Plugin utility tool that offers advice about specific changes introduced in Jakarta EE 10 that can impact Java EE 8 or Jakarta EE 9 applications. The upgrade advisor will scan your project and identify API changes in Jakarta EE 10 that can impact any part of your application. 

The tool can be run directly from the command line without any extra configuration required and is freely available inMaven Central.

Usage

Run the following command on the root of your project folder:

 mvn fish.payara.advisor:advisor-maven-plugin:1.0:advise

The Advisor tool will output the summary details:

[INFO] Showing Advisories
[INFO] ***************
[INFO] Line of code: 14 | Expression: public String registerConfigProvider(String s, Map map, String s1, String s2, String s3)
Source file: TestAuthConfigFactory.java
Jakarta Authentication 3.0 Issue # 87
 jakarta.security.auth.message.config.AuthConfigFactory.registerConfigProvider was changed from
 String registerConfigProvider(String className, Map properties, String layer, String appContext, String description)
 to
 String registerConfigProvider(String className, Map<String, String> properties, String layer, String appContext, String description)
This issue won't affect your application.
 The recommendation is to take care of the generic version.
[INFO] Line of code: 20 | Expression: public Class[] getSupportedMessageTypes()
Source file: TestAuthModule.java
Jakarta Authentication 3.0 Issue # 87
 jakarta.security.auth.message.module.ServerAuthModule.getSupportedMessageTypes was changed from
 Class[] getSupportedMessageTypes()
 to
 Class<?>[] getSupportedMessageTypes()
This issue won't affect your application.
The recommendation is to take care of the generic version.

The following is the structure of the Advisor’s Summary:

  1. On the first line:
    1. A standard message with the [Message Type] [Line of code] [Expression] format.
      1. Message Type: This can be either INFO, WARNING or ERROR
      2. Line of Code: Indicates the location of this occurrence in the code.
      3. Expression: The Java code expression or statement that triggered the occurrence of the advisory. For example: A method declaration, or a method call or an annotation property, etc.
  2. On the second line:
    1. The source file where the occurrence of the issue is reported.
  3. On the third line:
    1. A summary of the issue reported.
  4. On the fourth line:
    1. A set of recommendations given by the advisor to resolve the issue.

Basic Example

Consider the following code:

package fish.payara.upgrade;

import jakarta.json.bind.annotation.JsonbProperty;

public class JsonBeanTest {

    @JsonbProperty(nillable = true)
    private String name;
}

In Jakarta EE 10 theJakarta JSON Binding 3.0 API’s @JsonbProperty annotation was modified: Its nillable attribute has been marked as deprecated.

The upgrade advisor will report it as such when analyzing this code snippet and will present advice in what to do regarding this change:

[WARNING] Line of code: 7 | Expression: @JsonbProperty(nillable = true)
Source file: JsonBeanTest.java
Jakarta JSON Binding 3.0
 property nillable from the JsonbProperty annotation was deprecated.
This issue won't affect your application.
 and the recommendation is to stop use of the deprecated property nillable and
start to use the JsonbNillable annotation.

From the message we can see that the advisor recommends using the new annotation JsonbNillable instead, like this:

package fish.payara.upgrade;

import jakarta.json.bind.annotation.JsonbNillable;
import jakarta.json.bind.annotation.JsonbProperty;

public class JsonBeanTest {

    @JsonbProperty
    @JsonbNillable
    private String name;
}

Developers are encouraged to follow the recommendations given by the advisor to circumvent most of the challenges and pain points involved in the upgrade of any application to Jakarta EE 10.

Advantages if using the Upgrade Advisor Tool

The following are the advantages when using this tool:

  • Increase speed to make your older application compatible with Jakarta 10
  • Easy to understand what the cause of the issue is, and how to fix iy
  • Fast to execute and simple.

Conclusion

That's how you can use the Upgrade Advisor Tool to increase your speed and make your old Jakarta EE applications compatible with Jakarta EE 10.

Remember,Payara 6 Enterprisegives you a production optimized and commercially supported runtime for your mission-critical projects, combining our top-rated support and 10 year software lifecycle.

Related Posts

Comments