Sun GlassFish Enterprise Server v3 Prelude Quick Start Guide

Deploying and Undeploying Applications

The process of configuring and enabling an application to run within the Enterprise Server framework is referred to as deployment.


Note –

In the v3 Prelude release, applications can be packaged for deployment in web archive (WAR) format only.


This section explains how to deploy, list, and undeploy applications.

Obtaining a Sample Application

The procedures in this section use the hello.war application.

ProcedureTo Obtain a Sample Application

    To download a copy of the hello.war sample, go to https://glassfish.dev.java.net/downloads/quickstart/hello.war.

    Click Yes to save the hello.war file.

    Save the hello.war file in the directory of your choice. This document refers to this directory as sample-dir.

Deploying an Application from the Command Line

You can deploy applications from the command line by using the asadmin deploy command.

ProcedureTo Deploy the Sample Application From the Command Line

Before You Begin

The sample application must be available before you start this task. To download the sample, see Obtaining a Sample Application. At least one Enterprise Server domain must be started before you deploy the sample application.

  1. Use the asadmin deploy command.

    The general form for the command is:


    as-install/bin/asadmin deploy war-name
    

    To deploy the hello.war sample, the command is:


    as-install/bin/asadmin deploy sample-dir/hello.war
    
  2. Access the hello application by typing the following URL in a browser window:


    http://localhost:8080/hello
    

    The application's start page is displayed, and you are prompted to type your name.


    Hi, my name is Duke. What's yours?
  3. Type your name and click Submit.

    The application displays a customized response, giving you a personal Hello.

See Also

See deploy(1) for more information about the deploy command.

See Sun GlassFish Enterprise Server v3 Prelude Application Deployment Guide for more information about deploying applications from the command line.

ProcedureTo List Deployed Applications From the Command Line

    Use the asadmin list-applications command:


    as-install/bin/asadmin list-applications
    

ProcedureTo Undeploy the Sample Application From the Command Line

    Use the asadmin undeploy command.

    The general form for the command is:


    as-install/bin/asadmin undeploy war-name
    

    For war-name, use the literal hello, not the full hello.war name.

    For the hello.war example, the command is:


    as-install/bin/asadmin undeploy hello
    
See Also

See undeploy(1) for more information about the undeploy command.

Deploying an Application by Using the Administration Console

You can deploy applications from the graphical Administration Console.

ProcedureTo Deploy the Sample Application From the Administration Console

Before You Begin

The sample application must be available before you start this task. To download the sample, see Obtaining a Sample Application. At least one Enterprise Server domain must be started before you deploy the sample application.

  1. Open the Administration Console by typing the following URL in a browser window:


    http://localhost:4848
    
  2. Click the Applications node in the tree on the left.

    The node expands to display the Web Applications subnode.

  3. Click the Web Applications subnode.

    The Web Applications page is displayed.

  4. Click Deploy.

    The Deploy Enterprise Applications/Modules page is displayed.

  5. Select Packaged File to be Uploaded to the Server, and click Browse.

  6. Navigate to the location in which you saved the hello.war sample, and then click Open.

    You are returned to the Deploy Enterprise Applications/Modules page.

  7. Specify a description in the Description field, for example:

    hello

  8. Accept the other default settings, and click OK.

    You are returned to the Web Applications page.

  9. Run the sample application.

    • Click the Launch link on the Web Applications page.

    • Type the following URL in a browser window:


      http://localhost:8080/hello/
      
See Also

Refer to the Administration Console online help for further instructions.

ProcedureTo View Deployed Applications in the Administration Console

  1. Open the Administration Console by typing the following URL in a browser window:


    http://localhost:4848
    
  2. Click the Applications node in the tree on the left.

    The node expands to display the Web Applications subnode.

  3. Click the Web Applications subnode.

    The list of deployed web applications is displayed in the Deployed Web Applications table on the Web Applications page.

ProcedureTo Undeploy the Sample Application From the Administration Console

  1. Open the Administration Console by typing the following URL in a browser window:


    http://localhost:4848
    
  2. Click the Applications node in the tree on the left.

    The node expands to display the Web Applications subnode.

  3. Click the Web Applications subnode.

    The Web Applications page is displayed.

  4. Select the check box next to the applications you want to undeploy.

  5. Remove or disable the application.

    • To remove the application, click Undeploy.

    • To disable the application, click Disable.

Deploying an Application Automatically

To use automatic deployment, you can deploy applications by placing the applications in the as-install/domains/domain-name/autodeploy directory.

ProcedureTo Deploy the Sample Application Automatically

Before You Begin

The sample application must be available before you start this task. To download the sample, see Obtaining a Sample Application.

  1. Create a directory named as-install/domains/domain-name/autodeploy

    domain-name is the name of the domain for which you want to configure automatic deployment. For this example, use the default domain1 domain:


    as-install/domains/domain1/autodeploy
  2. Copy the application WAR file to the as-install/domains/domain-name/autodeploy directory.

    cp sample-dir/hello.war as-install/domains/domain-name/autodeploy

    Enterprise Server automatically discovers and starts the application.

ProcedureTo Undeploy the Sample Application

    Use the cd command to change to the domain's autodeploy directory.

    cd as-install/domains/domain-name/autodeploy

    Use the rm command to delete the application.

    rm hello.war