The process of configuring and enabling applications to run within the GlassFish Server framework is referred to as deployment.
This section explains how to deploy, list, and undeploy applications. The following topics are addressed here:
The procedures in this section use the hello.war sample application.
To download a copy of the hello.war sample application, go to https://glassfish.dev.java.net/downloads/quickstart/hello.war.
Save the hello.war file in the directory of your choice. This directory is referred to as sample-dir.
You can deploy applications from the command line using the asadmin deploy command.
The sample application must be available before you start this task. To download the sample, see Obtaining a Sample Application. At least one GlassFish Server domain must be started before you deploy the sample application.
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 |
Access the hello application by typing the following URL in your browser:
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? |
Type your name and click Submit.
The application displays a customized response, giving you a personal Hello.
See deploy(1) for more information about the deploy command.
See the Oracle GlassFish Server 3.0.1 Application Deployment Guide for more information about deploying applications 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 undeploy(1) for more information about the undeploy command.
You can deploy applications by using the graphical Administration Console.
The sample application must be available before you start this task. To download the sample, see Obtaining a Sample Application. At least one GlassFish Server domain must be started before you deploy the sample application.
Launch the Administration Console by typing the following URL in your browser:
http://localhost:4848 |
Click the Applications node in the tree on the left.
The Applications page is displayed.
Click the Deploy button.
The Deploy Applications or Modules page is displayed.
Select Packaged File to be Uploaded to the Server, and click Browse.
Navigate to the location in which you saved the hello.war sample, select the file, and click Open.
You are returned to the Deploy Applications or Modules page.
Specify a description in the Description field, for example:
hello
Accept the other default settings, and click OK.
You are returned to the Applications page.
Select the check box next to the hello application and click the Launch link to run the application.
The default URL for the application is:
http://localhost:8080/hello/ |
Refer to the Administration Console online help for additional information.
Launch the Administration Console by typing the following URL in your browser:
http://localhost:4848 |
Click the Applications node in the tree on the left.
Expand the node to list deployed applications. Deployed applications are also listed in the table on the Applications page.
Launch the Administration Console by typing the following URL in your browser:
http://localhost:4848 |
Click the Applications node in the tree on the left.
The Applications page is displayed.
Select the check box next to the hello sample application.
Remove or disable the application.
Refer to the Administration Console online help for additional information.
You can deploy applications automatically by placing them in the as-install/domains/domain-name/autodeploy directory, where domain-name is the name of the domain for which you want to configure automatic deployment. For this example, use the default domain, domain1:
as-install/domains/domain1/autodeploy |
The sample application must be available before you start this task. To download the sample, see Obtaining a Sample Application.
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
Use copy instead of cp on Windows systems.
GlassFish Server automatically discovers and deploys the application. The default URL for the application is:
http://localhost:8080/hello/ |