Migrate from your current JEE app server to Open Liberty in a few easy steps
The nine-part series Migrating Java Microservices from Spring Boot to MicroProfile covered the underlying components of Eclipse MicroProfile, such as the Rest Client for creating APIs for microservice applications, Context Dependency Injection for supporting annotation-based wiring, Fault Tolerance for problem recovery, and OpenTracing for diagnosing service issues.
This short blog touches on a specific how-to: Simple steps to migrate from your current JEE application server to Open Liberty, an enterprise-grade open-source application server. To demonstrate the steps, this blog will excerpt the required file changes using our reference implementation storefront app, BlueCompute. It’s implemented in both Spring and MicroProfile (GitHub source); the following two sections will cover the steps for each implementation migration.
MicroProfile: Steps for migrating your Java microservices app to Open Liberty
Clicking onto the BlueCompute repository’s MicroProfile branch will redirect you to the overall repository, but each microservice has its own build we must configure to use Open Liberty. To assist us, Liberty has a Maven plugin with documentation to help manage these configurations. If building with Gradle, you can check out Liberty’s Gradle plugin for its set of documentation.
Maven Coordinates (properties, artifactId): The excerpts below feature the orders repository, which uses the default approach of locating Maven artifacts. To edit this and other build details, we modified the
In this case, the
pom.xml is pointing to WebSphere Liberty WebProfile 8, version 18.104.22.168. Therefore, switching the runtime only requires swapping the group ID and artifact ID to specify Open Liberty instead:
Spring Boot: Steps for migrating your Java microservices app to Open Liberty
Luckily for us, Open Liberty has the Maven Boost plugin to make our lives much simpler, giving us a good place to start with a Spring app. Before we begin, we must first enable the Boost plugin in our
To build the app for the Open Liberty runtime, we simply run the
mvn package command. This will produce three jars in the resulting
target directory—one containing the original app (
jar.original), the app on Spring (
jar.spring), and the app on Open Liberty (
Similarly, the Spring branch also features a README to show how to run the Spring version of the app on Open Liberty.
As you can see, the Gradle and Maven Boost assistant plugins simplify the process of moving a Spring or MicroProfile-based Java application to Open Liberty with a few simple changes. The Open Liberty open-source project can act as a playground for some various modern DevOps technologies, such as Docker and Kubernetes. If you’d like to learn more, click a component in the following MicroProfile diagram; it will lead you to a corresponding blog in the series that goes into more implementation details:
For the developers more interested in studying microservices in general, check out the the Eclipse MicroProfile community, which seeks to optimize Enterprise Java. MicroProfile bundles many beneficial features for managing your app from various angles. You can start exploring using these sample app repositories that also run on the Open Liberty runtime.