Payara is a Java EE 8 / Jakarata EE 8 compliant application server, also implementing MicroProfile. Next to the traditional Payara Server, the company also provides you with the option of running your enterprise applications with Payara Micro. Since both editions of Payara can run your Java EE based enterprise applications, which edition should you use, and when? This depends on your situation, but before you are able to answer this question for yourself, let’s take a look at how both editions are being used.
The traditional application server allows you to run your Java EE based enterprise applications (WAR or EAR). It is possible to deploy, undeploy or manage your applications when the server is running. The application server can also be configured and tailored to your environment. This means that the application server can take the lion’s share of the work and configuration, while you can keep your applications clean, small and tidy. This is the idea behind Java EE: always try to keep your applications as small as possible, only containing your Java EE based business logic compiled against the various API’s whose implementations are provided by the application server.
Contrary to the Payara Server, this edition of Payara is provided as a “hollow” JAR. This means that Payara is provided as a single JAR file, containing the tools to run your application server with a java -jar command. As a parameter of this command, you can provide the application to run in this process like this:
java -jar payara-micro-5.191.jar --deploy my-javaee-app.war
Choosing your Payara
Now that you know how to use both editions of Payara, let’s consider which edition to use in what situation. You see, running either edition of Payara on your development, test or production environment should work. The clients of your running servers should in no way notice, or be impacted by the edition that you have chosen.
What cán matter is how you ship and run your applications on Payara. It depends on how you are running Payara in a microservices environment, possibly using Docker, and even an orchestrator like Kubernetes. Or maybe you are traditionally deploying your application on a Payara Server which is running on a server that is being fully managed by you. Either way, both editions of Payara are tailored for their runtime environments, but it is not necessarily true that you can’t use Payara Server for building and deploying microservices. Nor is it necessarily true that you can’t run a “monolith” with Payara Micro. I would like to spend another blog on these contemplations and get into the details, but they are way out of scope for this blog post. For now, let’s focus on where you can definitely benefit from one of them: your local development environment.
I have shown how to start Payara Micro on the command line, pointing to the exact location of the application to deploy. However, this is not very efficient during development for several reasons:
- You have to manually build the application with Maven every time, and possibly (manually) move it to the location where Payara can find it on the command line
- You have to start and stop Payara every time that you want to deploy a new version of your application
This can add up several seconds in development time, over and over again for every new deployment that you want to do. Luckily, there is a fairly easy way to (re)deploy your application on Payara, but this counts only for Payara Server. That is because this edition supports (re)deploying an application on a running instance.
You can easily run your Payara Server integrated in your IDE like Eclipse IDE, Netbeans or IntelliJ. For example, if you configure and manage Payara Server in your IDE like shown below, every time that you want to deploy a new version of your application, your IDE will take care of this process. It will compile and build a new WAR with Maven and deploy it on the managed Payara Server.
It often takes only a few seconds from building the application to redeploying it, which increases your development speed. And since it doesn’t feel that you have to wait for the deployment to finish, you shouldn’t lose your focus every time a deployment is running. This can save you a lot of personal energy and keep programming a fun thing to do. Also very important. 🙂
So if you are using Payara Micro in production, you can consider using Payara Server for optimizing your development experience until your application has to be shipped.
Interested in using Payara yourself? You can download both versions at https://www.payara.fish.