As of May 2018, Payara is not compatible with Java 9 or higher. If you are using Java 9 or higher, you will need to configure the server to use a Java 8 SDK.
To do so, navigate to /glassfish/config/ and change the following:
asenv.bat - Add "set AS_JAVA=PATH\TO\JDK.jdk"
For example: "set AS_JAVA=C:\Program Files\Java\jdk1.8.0_172.jdk"
asenv.conf - Add "AS_JAVA=/PATH/TO/JDK.jdk"
For example: "AS_JAVA=/Library/Java/JavaVirtualMachines/jdk1.8.0_172.jdk"
Building the web app
- Download and install the latest version of Payara or Payara Micro
- Build a copy of our Buildvu Microservice Example project. Instructions can be found on the GitHub page.
Deploying the web app
1. Start your Payara server and navigate to the admin console in your browser
- For example, the command
./bin/asadmin start-domainwill start the server on port 8080, with the admin console on port 4848 - check the README.txt supplied with Payara for detailed instructions.
2. On the home page, click on 'Applications' from the menubar on the left, then click 'Deploy'.
3. Either upload the .war file you built earlier or provide Payara with the path to it.
Type - Set this to 'Web Application'.
Context Root - If left empty, the default context root (usually the name of the .war file) will be used. For example, if your server is located at localhost:8080 and you've set the web app's context root to "microservice-example", you can find it at localhost:8080/microservice-example.
Virtual Server - Make sure you have a server selected, or the web app will fail to deploy.
The remaining options can be left as their default values or configured however you wish.
4. Click OK and you're done!
Payara Micro offers a quick and simple method of deployment. You can start the micro-server on port 8080 and deploy the web app with a single line:
java -jar payara-micro.jar --deploy /path/to/microservice-example.war