Best Practices To Deal With Javax to Jakarta Migration

Upgrading to Jakarta EE 9 or newer from an older version of Jakarta EE or Java EE can be a bit tricky with the javax to jakarta prefix change. Some libraries may be still using the javax package, which can cause conflicts when trying to run your applications on a Jakarta EE server like Eclipse GlassFish 7. You will likely encounter the same issues when upgrading to Spring Framework 6 or Spring Boot 3, Quarkus 3, and newer versions of many other frameworks, which now depend on Jakarta EE 9 APIs.

But don’t worry, I’ve got you covered! In this post, I’ll explain everything you need to know to upgrade to Jakarta EE 9+ successfully and in almost no time. By Jakarta EE 9+, I mean either Jakarta EE 9 or 10, which is currently the latest version of Jakarta EE.

How To Upgrade to Jakarta EE 10 and GlassFish 7

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.

Unlock the Power of Jakarta EE With These Awesome Resources!

Jakarta EE is the open-source version of the Java EE platform, developed by the Eclipse Foundation. It is a standards-based platform for developing enterprise Java applications. It provides a set of APIs and tools to help developers build robust enterprise applications.

The benefits of using Jakarta EE are numerous. It is a mature platform that provides a stable and reliable foundation for enterprise application development. Furthermore, it is an open-source platform, which means that developers can benefit from the collective knowledge and experience of the entire Java community.

Get Logged-in User Info in Jakarta EE – The Simplest Way

The security before Java EE 8 / Jakarta  EE 8 used to be a bit complicated and confusing. Every specification provided its own way to retrieve information about the logged-in user. The situation greatly improved with the introduction of the Security API that provides a unified way to do that – simply inject the SecurityContext CDI bean. 

There’s still a small catch – this only works in the servlet context and EJB context. Or, in other words, when processing an HTTP request or inside any type of EJB. The good thing is that this covers most of the cases in which you’ll ever need to retrieve user information. In the other rare cases, you need to use one of the APIs which I also describe in this post.