
Leading the Way: Payara Platform Community 7 Beta Now Fully Jakarta EE 11 Certified
We’re excited to announce that Payara Platform Community 7 Beta application server is now fully certified as Jakarta EE 11 […]
Nowadays, the concept of microservices is more than a simple novelty. With the advent of DevOps and the boom of container technologies and deployment automation tools, microservices are changing the way developers structure their applications. With this article, our intention is to illustrate that microservices are a valid option for Java/Jakarta EE developers and how Payara Micro is a robust platform to reach that goal.
The main purpose of a microservice architecture is to break down an application into smaller standalone components that are easier to handle, deploy, scale and maintain in the long term. Sounds familiar? Yes, this is something that many developers have been doing since a long time ago! Encapsulation, cohesion and a good understanding of service-oriented architectures have helped them apply this “divide and conquer” strategy to software architecture for many years and will do so in the future as well.
So, what’s the advantage of a microservice architecture, then? Microservices are better understood when compared with their traditional counterparts: monolithic applications. Monolithic applications, or monoliths, are usually big enterprise applications structured into a single deployable package. If you want to introduce a new component or update an existing one, the entire monolith must be updated at once. This is the way enterprise applications were usually developed, focusing on the concept of tiers (UI, middleware-services, persistence, data) and the segregation of concerns across these tiers.
So, while a monolith is just a normal application developed with traditional means, the microservice architecture approach would be to break down such an application into its separate component units (or just services), so that each unit would fulfill the following criteria:
{{cta(‘9e1cfc58-6eae-43d2-8ebd-c1825e874e70’)}}
So, does that mean that microservices should be used instead of the traditional monolith in all cases? Not necessarily. Microservices not only define a new architectural style, but also require that development teams build applications in a different manner.
There are also some advantages and disadvantages regarding when to use a monolith and when to use microservices: (Considered advantages are green, disadvantages are red, orange is for variable benefits depending on the software requirements or the organization’s environment.)
Monoliths | Microservices |
Cost of changes across all tiers is high. A change of a single feature means a redeployment of the whole unit. | Changes are easier to implement and not costly as they are targeted to specific services only. |
All components belong to a single unit, there’s no communication overhead. | Remote calls are needed for communication between services, so this overhead factors in the performance of the overall application. |
The entire development team must be familiarized with the design and composition of the entire application. | Each service can be handled by a separate team, so this favors separation of concerns and responsibilities. |
Developed with a technological stack in mind, using one or two languages of choice. A main language/framework is chosen to govern the software architecture. | Each service can be developed using a different framework based on its requirements and needs. Standards are discarded in favor of improving each service with the right tools. |
Easier to deploy. | The complexity of deployment increases with the number of services and the communication routes between them. |
Clustering can be as easy or difficult depending on all the features implemented across the monolith. | Since each micro-service is small, clustering is generally easy, with scalability being a primary drive. |
Failure of a component can cause the entire application to fail and hinder the user experience. | Failure of a service will only bring that specific service down, leaving other services untouched. |
There’s a focus on tiers and integration across tiers. | There’s a focus on business needs and communication concerns between teams. |
Microservices can help an organization develop their applications in such structured way. But sometimes, when applications are not critical to their business, or their quality attributes (performance, availability, scalability, security, etc.) are not specifically demanding, the traditional monolithic approach is more than enough.
The Java EE 8 set of specifications allows the creation of monolithic applications with ease. The main benefit of being a Java EE developer is that you don’t have to worry about handling technical concerns like network handling, transaction management or a resource’s lifecycle when the specific container service does that for you. This simplifies the developers’ work allowing them to focus on business concerns instead.
In the case of Java EE, a monolithic application’s example could be an e-commerce application with the following characteristics:
Sounds complex? Yes. The previous scenario was a common occurrence in earlier Java EE days, but nowadays, with tools like Maven or OSGi, modularizing Java EE application has simplified the development of monoliths on Java EE, meaning that your entire application can be deployed in a single WAR file. However, if you would like to implement this e-commerce application as a set of microservices, a simple WAR will not be enough.
There are no technology restrictions that prevent you to create microservices using the Java EE APIs via an application server like GlassFish (and Payara Server by extension). However, there are some considerations to have in mind:
Payara Micro was created with these concerns in mind: it’s relatively smaller in size, packaged as a JAR, and allows developers to easily run a microservice with a simple command:
java -jar payara-5.191.jar —deploy user-service-1.0.war —contextRoot /
Run this command for each service and you don’t have to worry about a long startup time for your service or having to repeat the installation of a server multiple times! Since Payara Micro is based on the Java EE Web Profile, this means that complex or legacy APIs won’t be available (like JMS, JCA, JAX-WS, EJB Remote, etc.)
One of the main advantages of using Payara Micro to provision a microservices architecture is its ability to automatically form a cluster with other Payara Micro instances that are living in the same network. Here’s a the most basic sample of launching a cluster of 2 instances:
> java -jar payara-micro-5.191.jar —autoBindHttp —clusterName user-service –name us-instance-1
> java -jar payara-micro-5.191.jar —autoBindHttp —clusterName user-service –name us-instance-2
Once a new instance joins the cluster, every instance will report the current status of the Domain Data Grid (the conceptual equivalent of a modern cluster of server instances), letting you know that the cluster is scaling:
[INFO] fish.payara.nucleus.cluster.PayaraCluster] [tid: _ThreadID=61 _ThreadName=hz._hzInstance_1_user-service.event-3] [timeMillis: 1553274856105] [levelValue: 800] [[
Data Grid Status
Payara Data Grid State: DG Version: 35 DG Name: user-service DG Size: 2
Instances: {
DataGrid: user-service Instance Group: MicroShoal Name: us-instance-1 Lite: false This: true UUID: 634c290e-d972-45f0-93c8-241deb279f0d Address: /192.168.1.70:6900
DataGrid: user-service Lite: false This: false UUID: e5718197-6c83-4225-8aac-9d7892ef5bec Address: /192.168.1.70:6901
}]]
This is in thanks to Hazelcast IMDG, which is an open source distributed In-Memory Data Grid solution for Java applications that powers Payara Micro’s (and Server) clustering mechanisms. By default, Payara Micro instances cluster with each other using the multicast protocol, but in network environments where multicast is not supported (like Docker or certain cloud providers like AWS) other network communication mechanisms are supported as well. Additionally, Payara Services Ltd is working hard at implementing native support for a multitude of topologies and cloud providers, so keep and eye on what’s to come!
At Java One 2017, Oracle made the huge announcement to open source the Java EE technology in its entirety, surprising the Java community. The new home of the Java EE technology would be the Eclipse foundation under the new name Jakarta EE (chosen in a democratic vote by the community after the Apache Foundation kindly “donated” the name).
As of March 2019, the process of transferring the entire set of specifications, reference implementations and TCKs to the Eclipse Foundation is still underway but a major milestone was reached at the end of January: Eclipse GlassFish 5.1 was released to the public! This version of GlassFish is technically compatible with Java EE 8 and will pave the way for the first release of the Jakarta EE specification: Jakarta EE 8 later in the year. Once that milestone is reached, the community will move forward to a new version of the specification which will include a lot of new improvements the existing APIs. This blog post from Arjan Timms introduces the most interesting ideas that at the moment are being implemented in the existing projects that have been transferred to the Eclipse Foundation.
Having said all of this, what are the advantages of Jakarta EE over Java EE for microservice architectures then? Well, the answer is simple: None, since even after Jakarta EE 8 is released it won’t be any different in the scope of its features from Java EE 8. However, now that the technology has been open sourced and will be moved forward by the concerted efforts of the community, the existing APIs can be evolved with microservices patterns in mind, which will lead to a greater simplification of the development and deployment needed for these architectures! Even better, new APIs can be implemented in order to bridge the gap in the current set of features (like an API to modularize deployments or a standard API to orchestrate deployment units in a distributed arrangement). There are high expectations on the future of the Platform now that Oracle is no longer calling the shots with a renewed focus on modernizing the technology.
Although Jakarta EE is looking up good for providing a complete technology for microservices based on Enterprise Java, it is not the only technology that compatible Java EE servers can use. The Eclipse MicroProfile API is a set of standardized APIs aligned with the Java EE 8 specification that vendors can implement in order to develop microservices.
The goal of MicroProfile is to provide components that build upon the core features of Java EE allowing a more intuitive development experience when implementing microservices, granting more flexible options and reduce risks or over-designing and re-inventing the same patterns.
The current version of Eclipse MicroProfile is v2.2 and it is composed of the following set of APIs:
Both Payara Server and Micro are compatible and certified implementations of Eclipse MicroProfile (version 5.191 is compatible up to MicroProfile v2.1 however). This means that you can use all MicroProfile’s APIs in conjunction with other Java EE APIs, and this is not limited for the development of microservices only. If you want to develop a traditional monolith while benefiting of the features and facilities introduced by MicroProfile, then you can just do that! Flexibility is a key concern of the Payara Platform.
You still need to go the extra mile and guarantee that your services fulfill the criteria described previously to develop enterprise-ready microservices, since the standard practices for developing Java EE applications will not be enough. The following is a list of my personal good practices and recommendations that you should follow when building micro services with Java EE and Eclipse MicroProfile:
In most cases these 3 sources are more than enough for production needs (environment variables are fairly used in conjunction with containers), but the API allows for customizable configuration sources as well (like reading from a database or a configuration server too).
Always make use of Payara Micro’s auto-clustering capabilities, which will allow you to implement elastic deployments in your infrastructure.
Docker containers are a must! Configure your application’s deployment with a Docker image that can help you automate the deployment process of your microservices. Better yet, use the official Payara Micro image to create your own!
Lastly, consider using orchestration tools to organize clusters of your micro services like Apache Mesos, Consul, Google Kubernetes or Docker Swarm. Both Payara Server and Payara Micro support native Kubernetes clustering even, so if you use it for orchestrating a distributed infrastructure, you can quickly configure how each node/instance joins the cluster using the kubernetes discovery mode provided by the Domain Data Grid.
Microservices are here to stay, so any enterprise organization should consider implementing a microservice architecture when there are enough benefits to reap. For this reason alone, Java EE cannot be left behind and must move on in order to help developers transition to this style, which is goal that is no longer a dream thanks to both Jakarta EE and MicroProfile. Payara Micro is the ideal place to start, especially if you’re already familiar with the development of Java EE applications.
Keep in mind that microservices are not a silver bullet, and this should be common knowledge: use the traditional monolithic approach whenever possible, and switch to microservices when you think that their benefits suit your needs and justify their use. This transition not only means having a good grasp of the technical challenges you will be facing, but also understanding that there can be organizational and business constraints to be considered as well.
{{cta(‘4129273b-d6b4-4ef3-8fb7-412a2d0dfdfb’,’justifycenter’)}}
Share:
We’re excited to announce that Payara Platform Community 7 Beta application server is now fully certified as Jakarta EE 11 […]
Welcome aboard the August 2025 issue of The Payara Monthly Catch! With summer in full swing, things may have felt […]
Enterprise Java applications power global commerce, healthcare, government and countless other industries. These systems must be scalable, secure and […]
Thanks a lot. This is very informative.
Hello Fabio
Great article! Congratulations
I am evaluating the payara for my company to start using and would like to know if I can get some doubts with some jee engineer? How could he do that?
Greetings Fernando,
If I understand correctly you are looking for advice on the technical details and know if you should use the Payara Platform on your company, correct? The best advice I can give you is for you to contact Payara Services through the official contact form: https://www.payara.fish/about/contact-us/. We’ll reach out to you as soon as possible to get more details and see how we can proceed.
Cheers,
Fabio.
I tryed to start payra micro as in this article “java -jar payara-5.191.jar –deploy user-service-1.0.war –contextRoot=/ ” but i always get the message ” Argument(s) provided are invalid: -contextRoot=/.”
Hello Florian,
I believe there’s a typo in the blog for that example.
There should be two dashes, and no equals sign, like so:
–contextRoot /
I’ve corrected the example in the blog.
Thanks for contacting us!
Andrew
I am a professor. What I need is a step wise demo app of clustered instances of micro services using hazelcast with JPA .
Hi Kamlendu. Unfortunately, there aren’t public demos for any microservice applications that are configured to be clustered using JPA. I’m assuming that since you are mentioning Hazelcast you might want to configure JPA Cache Coordination to allow JPA-entities to be cached in the cluster, correct? In that case, you can read this excellent blog article that details the instructions to do so: https://www.payara.fish/blog/setting-up-cache-jpa-coordination-with-the-payara-platform-using-eclipselink-and-jms/hazelcast. Other than that, in order to configure clustering for Payara Server/Micro, you can read the official documentation as well: https://docs.payara.fish/documentation/payara-server/hazelcast/
Thank you for your valuable answer.
You say: “If you are considering using JSF pages for the user interface, consider using stateless views (). ” – Wondering why? All we should to do, is to use JSON-B 1.0, in order to make Java classes needed by JSF, from JSON object returned from REST API. isn’t that enough?
Hi,
When using stateless views, it is easier to scale your application as you do not need a sticky session or Session replication to make data available on all your instances. However, a complete stateless application is very hard to create since all data need to be passed as parameters to each JSF request, including user information.
You mention JSON-B which is not correct. JSF is a server-side rendering technology so you do not send the data through REST endpoints to your front end (browser). JSF is using your Java classes directly at the server to generate it.
Regards
Rudy
Hi @Rudy De Busscher, and thanks for reply.
Maybe I didn’t express myself well.
When I mention JSON-B, I had in mind the following:
Consider simple data displaying app, with usual JSF data table.
In order to make a value/model for that table, I need collection/ArrayList of Java objects.
If the data is to be provided by one microservice, all I have to do is call that one microservice from within a CDI (let say a ViewScoped) bean. As a result of that call, I will get the JSON structure. Then I can use fromJson() method:
https://javaee.github.io/javaee-spec/javadocs/javax/json/bind/Jsonb.html#fromJson-java.lang.String-java.lang.Class-
in order to make Java class for my JSF table model.
You can also map the whole collection in similar way.
Correct me if I’m wrong, but this way can organize the whole JSF application that works with microservice backend, is not? I don’t see any annoyance about doing it that way.
Could you clarify, what are traditional means? When I read microservices.io, it sounds just like reading Java EE stuff. I could see maybe Spring Apps or non-tiered web-apps as monoliths, but microservices sounds EXACTLY like Java EE and pre-Java EE applications.
Greetings Christopher,
I think that you are a bit confused. Let’s check the main definition given on microservices.io:
——
Microservices – also known as the microservice architecture – is an architectural style that structures an application as a collection of services that are
* Highly maintainable and testable
* Loosely coupled
* Independently deployable
* Organized around business capabilities
* Owned by a small team
—–
And yes, in many ways, traditional Java EE applications and pre-Java EE applications apply some of these principles. The key is in the details, especially in the “independently deployable” part, as Java EE traditional apps were designed to be highly composable artefacts made of separate modules, each one with either specific or shared dependencies, which required specific constraints to be deployed. In the modern development landscape, having a small team of engineers (3~5) to maintain a big monolith application composed of 10+ modules might not be the best option if there are constant updates to only 2 or 3 of these modules. Why? Because you need to build the entire monolith on every update and risk breaking other modules since all of them compose the same deployment unit. Under a microservice architecture, each module would be a separate deployment unit (each one under separate environment runtimes) and changes to one of the modules would minimally affect the others.
Hope that my explanation makes sense.
Cheers,
Fabio.