How to Deploy an Application on Payara Server 5

Uncategorized

This is Part 2 of our Payara Server – Back to Basics series, see Part 1 – Installing Payara Server on Ubuntu here.

In order for a web application to run, it must be first deployed on an application server such as Payara Server. Deployment in the context of web applications is the act of installing the application on a server. It allows requests to be handled and so on. This guide will provide you with a few different ways to get your application running.

If you’re currently on GlassFish and want to try deploying an application to Payara Server, migrating is relatively painless! Check out our migration guide:

{{cta(‘39319061-9b0e-4e3b-ae3c-03f0b547d094’)}}

Setup

1) For simplicity, this demonstration will be using a sample application called clusterjsp.war, the source code of which can be downloaded from:https://github.com/eclipse-ee4j/glassfish-samples/tree/master/ws/javaee6/ha/clusterjsp.

2) Place your application or the hello application into a directory of your choosing. Lets refer to this directory as sample-dir .

3) Before you begin to deploy any application, at least one Payara Server / GlassFish domain must be started. For guidance on how to do this refer to my previous GlassFish Back to Basics blog at https://www.payara.fish/blog/back-to-basics-installing-payara-server-5-on-ubuntu .

Deploying an Application from the Command Line

1) Use the asadmin deploy command in your shell box. The form of the command is as follows:

install-directory/bin/asadmin deploy sample-dir/war-name

(install-directory is where Payara Server is installed)

deployapplication

2) To list the deployed application, use the list-applications command as shown below

listapplications

3) To access the application, navigate to http://localhost:8080/clusterjsp/ to see this page:

clusterjsp_application

Undeploying an Application from the Command Line

1) In this case, use the undeploy command as similarly done for deploy:

install-directory/bin/asadmin undeploy war-name

However, for war-name, omit the .war extension and refer to it by just the name. For example:

undeploy_application

Deploying an Application from the Administration Console

1) Access the administration console by navigating to http://localhost:4848 (make sure a domain is running beforehand).

2) Click on applications under the heading common tasks on the left side of the page.

3) Any deployed applications are listed here. Since there are none right now, click on deploy.

4) The current display should be the deploy applications or modules page. There are two options available. Select Packaged File to be Uploaded to the Server and click browse. Navigate to where your application is located. Select the file and click open. You should be returned to the same page with some settings listed below. If the steps have been done correctly, it should look like this:

deploy_clsuterjsp_adminconsole

5) Change any settings if needed otherwise accept the default settings and click ok to be returned to the applications page. Your application should now be listed.6) Finally, under the action tab click launch. The default URL for the application is http://localhost:8080/appname  In this case http://localhost:8080/clusterjsp.

Undeploying an Application from the Administration Console

1) Go to http://localhost:4848 .

2) Click on applications under the common tasks header.

3) Select the check box next to the application you wish to undeploy.

4) To undeploy the application – click undeploy. To disable the application – click disable.

Deploying an Application Automatically

1) Make sure a domain is at least running. Copy your application to theinstall-directory/glassfish/domains/domain-name/autodeploy directory. The default domain is called domain1.Doing the same step in terminal is shown as follows:

autodeploy_copy_clusterjsp

2) Finally go to http://localhost:8080/hello to access your application.

Undeploy an Application Automatically

1) Simply delete the application file from the directory. In terminal :

remove_autodeploy_clusterjsp

And that’s all! Want a complete, step-by-step guide to getting started with the Payara Platform? We’ve got an online and printable guide for that: 

{{cta(‘7a5cce4a-1c08-4a04-a259-3c85c1934c9d’)}}

 

Note: This blog is an updated version from How to Deploy an Application on Payara Server 4 / GlassFish 4.1. If you’re using Payara Server 4 or GlassFish 4.1, read this original version.

Comments (5)

Post a comment

Your email address will not be published. Required fields are marked *

Payara needs the contact information you provide to us to contact you about our products and services. You may unsubscribe from these communications at any time. For information on how to unsubscribe, as well as our privacy practices and commitment to protecting your privacy, please review our Legal & Privacy Policy.

  1. Chandresh Patel

    Nice blog. I recommend using DevOps tool to automate this. Here is an example.
    https://flexagon.com/2018/04/automate-deployments-to-payara-application-server/

  2. Ghazy Abdallah

    Does Payara support graceful (Disable or Undeploy) meaning it will stop receiving new requests and wait for current process to finish processing ?

    1. Jonathan Coustick

      No, Payara does not currently support graceful stoppage. While requests may complete, long running ones, particularly long-running or asynchronous ones are likely to return a 500 error as the server is stops them before they are finished.

  3. Piotr Jonarski

    Hi, I stuck into issue with Payara micro. App works different when is deployed on private IP and public IP (it is only one major difference). On private ip machine (in Oracle VM) app works fine, but on server (from internet provided) SessionScoped Bean is created many times during simple authentication and I can’t use it. It doesn’t work as it should. Do You have any idea what can be wrong?

  4. Jadon Ortlepp

    Hi Piotr, please post your question in the Google Forum, where it will be easier for the team to look at and discuss your issue. https://groups.google.com/forum/?nomobile=true#!tags/payara-forum/payara-server . Best of luck.

Related Posts

4 minutes
Uncategorized

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 […]

What Is a Java Application Server? A Short Guide 6 minutes
Jakarta EE

What Is a Java Application Server? A Short Guide

Enterprise Java applications power global commerce, healthcare, government and countless other industries. These systems must be scalable, secure and […]

10 minutes
Uncategorized

Java’s 30th Anniversary: A Celebration of Legacy, Evolution and Community

May 2025 marks a monumental milestone in software development: Java turns 30. The impact of this language on the […]