DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
Refcards Trend Reports
Events Video Library
Refcards
Trend Reports

Events

View Events Video Library

Zones

Culture and Methodologies Agile Career Development Methodologies Team Management
Data Engineering AI/ML Big Data Data Databases IoT
Software Design and Architecture Cloud Architecture Containers Integration Microservices Performance Security
Coding Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Culture and Methodologies
Agile Career Development Methodologies Team Management
Data Engineering
AI/ML Big Data Data Databases IoT
Software Design and Architecture
Cloud Architecture Containers Integration Microservices Performance Security
Coding
Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance
Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks

Elevate your data management. Join a lively chat to learn how streaming data can improve real-time decision-making, and how to reduce costs.

Platform Engineering: Enhance the developer experience, establish secure environments, automate self-service tools, and streamline workflows

Build Cloud resilience. High-profiled cloud failures have shown us one thing – traditional approaches aren't enough. Join the discussion.

Data Engineering: The industry has come a long way from organizing unstructured data to adopting today's modern data pipelines. See how.

Related

  • Java EE 6 Pet Catalog with GlassFish and MySQL
  • From J2EE to Jakarta EE
  • Limited Conversations With Distributed Systems
  • Querydsl vs. JPA Criteria, Part 5: Maven Integration

Trending

  • Front-End Debugging, Part 1: Not Just Console Log
  • Advice for Anyone Who Wants to Be a Developer
  • MuleSoft: Best Practices on Batch Processing
  • LLMops: The Future of AI Model Management
  1. DZone
  2. Coding
  3. Java
  4. How To Upgrade to Jakarta EE 10 and GlassFish 7

How To Upgrade to Jakarta EE 10 and GlassFish 7

It’s much easier than you think! There are automation tools that will help you, and example projects by OmniFish to show how to use them.

By 
Ondro Mihalyi user avatar
Ondro Mihalyi
·
Jun. 28, 23 · Tutorial
Likes (1)
Comment
Save
Tweet
Share
3.2K Views

Join the DZone community and get the full member experience.

Join For Free

Upgrading to Jakarta EE 10 from an older version of Jakarta EE or Java EE can be a bit tricky and may require some extra attention to detail. One of the main things you may encounter is making sure your existing code and libraries are compatible. Some libraries may still be using the javax package, which can cause conflicts when trying to run your applications on a Jakarta EE server like Eclipse GlassFish 7. You might also run into problems with some deprecated APIs that were removed in Jakarta EE 10. 

But don’t worry; there are automation tools to help you with the upgrade and examples of how to use them, which I created in the OmniFish GitHub repository.

Types of Challenges

The challenges with upgrading to Jakarta EE 10 or GlassFish 7 fall into these 3 main categories:

  • Changing the javax package prefix to jakarta requires updating all references to the old packages
  • Obsolete annotations may need to be replaced with alternative annotations
  • Rewriting code that uses removed APIs, which don’t have straightforward alternatives

All of the above applies not only to your codebase but to all dependencies used by your application. Many popular libraries already have a new version compatible with Jakarta EE 10, so it’s enough to update them. But some libraries might not support Jakarta EE 10, and special adjustments will be needed. Luckily, there are tools to automate this, both on the source code level and binary (byte code) level.

Existing Tools To Automate Upgrade Steps

Fortunately, many challenges can be automated using free and open-source tools like OpenRewrite, WindUp, and Eclipse Transformer. OpenRewrite is a powerful tool that can automatically make changes to your application’s source code, such as updating all references to the old javax packages with the new jakarta prefix.

In order to use OpenRewrite, you need a recipe for Jakarta EE 10 migration. WindUp provides such a recipe. And not only that. WindUp also provides a UI and can automatically analyze your application, report all the changes needed to upgrade it, and then apply the changes for you, using OpenRewrite under the hood.

Eclipse Transformer, on the other hand, can automatically transform the final JAR, WAR, or EAR binary files. This is useful if you want to try running your older application on a Jakarta EE 10 runtime or if some parts of your application or its dependencies can’t be easily upgraded or refactored.

All these tools can save you time and effort when upgrading to Jakarta EE 10, allowing you to focus on other important aspects of your application’s development. However, it’s still important to review and test the changes made by these tools to ensure that they don’t introduce any unintended consequences.

Dealing With Backwards Incompatible Changes in Jakarta EE 10

It’s important to note that some libraries, mostly those related to Jakarta Faces (JSF), may not yet provide a compatible version with Jakarta EE 10. They may still depend on APIs that have been removed from the platform. It’s essential to identify these libraries in your application and take appropriate action. 

One option is to replace the incompatible libraries with other compatible libraries that provide similar functionality. Another option, if the library is open source, is to rewrite the code of that library so that it doesn’t depend on the removed APIs. In some cases, it may be necessary to provide a compatibility layer to bridge the gap between the old and new APIs, for example, to supply the code of removed APIs directly in your application. This can involve creating a separate module or library that emulates the old APIs and provides the necessary functionality. Regardless of the approach, it’s crucial to address these compatibility issues to ensure that your application runs smoothly on the Jakarta EE 10 platform.

How To Address All of This

As a start, I’ve created a repository with examples of how to upgrade some existing applications.

For example, the javax-jakarta-transform-whole-war example shows how to use the Eclipse Transformer maven plugin to modify the WAR file and the exploded WAR directory to convert everything to use the jakarta. prefix. With this configuration, it’s possible to deploy the resulting WAR file to GlassFish 7 via Admin Console, and it’s also possible to run the application from an IDE like Netbeans and debug it on GlassFish 7 as usual.

You can find further instructions on upgrading your applications easily to Jakarta EE 10 in my article series called Upgrading to Jakarta EE 10 at the OmniFish blog. It currently covers the following topics:

  • Transform Applications with Eclipse Transformer
  • Transform Application Source Code

In the near future, I'll be adding more articles to cover more details, like how to upgrade dependencies to Jakarta EE 10, how to transform them if needed, and how to refactor your code to remove usage of APIs removed in Jakarta EE 10. I hope that this series of articles will help you upgrade to Jakarta EE 10 easily and in a very short time.

GlassFish Java EE

Published at DZone with permission of Ondro Mihalyi, DZone MVB. See the original article here.

Opinions expressed by DZone contributors are their own.

Related

  • Java EE 6 Pet Catalog with GlassFish and MySQL
  • From J2EE to Jakarta EE
  • Limited Conversations With Distributed Systems
  • Querydsl vs. JPA Criteria, Part 5: Maven Integration

Partner Resources


Comments

The likes didn't load as expected. Please refresh the page and try again.

ABOUT US

  • About DZone
  • Support and feedback
  • Community research
  • Sitemap

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Core Program
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 3343 Perimeter Hill Drive
  • Suite 100
  • Nashville, TN 37211
  • support@dzone.com

Let's be friends: