Skip to main contentModernization   Playbook

Refactoring Java EE Applications

A phased approach to refactoring a Monolith in to Micro Services

A phased approach to refactoring a Monolith in to Micro Services

Introduction

This document descibes the phases that were performed to modernize the Customer Order Services application taking the legacy JEE6 application, removing older technologies, updating the frontend and strangling a microservice. Niklas describes the process in the video below:

How the Application was Modernized

The Customer Order Services application is a simple store-front shopping application, built during the early days of the Web 2.0 movement. Users interact directly with a browser-based interface and manage their cart to submit orders. This application is built using the traditional 3-Tier Architecture model, with an HTTP server, an application server, and a supporting database.

There are several components of the overall application architecture:

  • Starting with the database, the application leverages two SQL-based databases running on IBM DB2.

  • The application exposes its data model through an Enterprise JavaBean layer, named CustomerOrderServices. This components leverages the Java Persistence API to exposed the backend data model to calling services with minimal coding effort.

    • This build of the application uses JavaEE6 features for EJBs and JPA.
  • The next tier of the application, named CustomerOrderServicesWeb, exposes the necessary business APIs via REST-based web services. This component leverages the JAX-RS libraries for creating Java-based REST services with minimal coding effort.

    • This build of the application is using JAX-RS 1.1 version of the respective capability.
  • The application’s user interface is exposed through the CustomerOrderServicesWeb component as well, in the form of a Dojo Toolkit-based JavaScript application. Delivering the user interface and business APIs in the same component is one major inhibitor our migration strategy will help to alleviate in the long-term.

  • Finally, there is an additional integration testing component, named CustomerOrderServicesTest that is built to quickly validate an application’s build and deployment to a given application server. This test component contains both JPA and JAX-RS-based tests.

    Step 1

Move the monolith to WebSphere Liberty with minimal changes

The first phase of the modernization is to move the existing JEE6 application from traditional WebSphere ND to a WebSphere Liberty container using IBM Cloud Transformation Advisor

Step 3

This phase has it’s own section in this playbook titled Runtime Modernization

Separate the frontend from the monolith

Once the monolith is containerized the application owners may choose to separate the frontend application code (DOJO based) from the monolith’s EAR file in to a separately deployable component. With the front and backend separated they can be developed, tested and deployed independently.

Step 4

A more detailed description of the steps that were taken in this phase can be found here

Move the backend monolith to OpenLiberty

In this phase the JEE6 EJB code is modernized to use MicroProfile and is then able to run on the latest open source version of Liberty (OpenLiberty)

Step 5

A more detailed description of the steps that were taken in this phase can be found here

Refactor the Catalog service to Quarkus

In this phase the backend application was analyzed and the Catalog service was identified as a candidate to be extracted in to it’s own Micro Service. The code was strangled from the monolith and deployed using Quarkus

Step 6

A more detailed description of the steps that were taken in this phase can be found here

Building Micro-frontends and further modernization

The next logical step in the modernization journey is to address the legacy circa-2010 web front end and replace it with micro frontends. You may be interested in articles that describe how to create Micro frontends with SPA and loosely coupled micro frontends with RxJS

Summary

This application has been refactored in a series of steps from the original WebSphere ND v8.5.5 version to run as Micro Services on Red Hat OpenShift.