In my previous post, I wrote about how I manually deployed a working GlassFish web server for Java based web apps.
In this post I want to expand on it, and also give some updates, since I’m writing these posts while I’m learning.
Moving to Payara from Glassfish
Even though I was able to successfully deploy the webapp in Glassfish according to my previous post, I came across different incompatibilities, since Glassfish 5 only supports Java 8 while the project I’m contributing is made with Java 11, also VS code won’t allow me to change to Java 8 as the default runtime because it too requires Java 11 as the runtime.
Also I found that there were some wired bugs in Glassfish5 administrator panel. Finally after some more searching I came across Payara, a web server that is built on top of Glassfish. They have a free community edition and an enterprise edition. I think due to the enterprise edition the project is more maintained than Glassfish. And Payara supports Java 11. So I won’t be running into incompatibility issues.
And the previous steps that I used to setup a Glassfish web server will still apply for Payara since it’s also based on Glassfish.
The settings, the dashboard, folder structure everything will be the same on both Paraya and Glassfish.
Setting up a community server on VSCode
If you are someone like me using VSCode as the regular text editor, there is an even easier way to setup a Paraya, Glassfish or even a Tomcat server straight through your editor. Without all the hassle I showed you earlier. However, this is only possible in a developer environment and you will have to actually deploy the server as I mentioned in the previous post of you are doing a remote deployment.
Step 1 – Download the ‘community server connectors’ extension
Goto VSCode marketplace or from within the VSCode extension tab search for the community server connectors extension and install it on VSCode. This will also install 3 additional dependency extensions as well.
Once you have installed the extension you will be asked to restart your editor, and after restarting you will see a sever tab on your sidebar.
Step 2 – Install the community server
As the name suggest the extension is able to install various different community servers, such as Apache Tomcat, Apache Kafka, Apache Felix, GlassFish, Paraya etc. It can also install different versions of these servers as well.
If you have already downloaded a server on to your disk, you can also load that as well instead of downloading the server from the internet.
Step 3 – Start your server
Once downloaded, or opened your server will appear on the sidebar, you can run the server by right clicking on the server and click start server, you can stop, restart, debug within the VSCode without touching the terminal.
In the next post I will explain how you can deploy your Java webapp to your newly setup Paraya server.