Sun Java System Application Server 9.1 Quick Start Guide

Deploying a Sample Web Application

These procedures assume that you are running a domain with developer profile.

ProcedureTo Deploy the Hello Application Using Autodeploy

The server installation includes a pre-packaged application that says “Hello,” taken from The Java EE 5 Tutorial. The Hello application is contained in a Web ARchive (WAR) file in the samples/quickstart directory. Packaged applications can also be in the form of a Java ARchive (JAR) or Enterprise ARchive (EAR) file.

Alternatively, you can download this application from The Java EE 5 Tutorial or from http://glasfish.dev.java.net/downloads/quickstart/hello.war.

Copying to a domain’s autodeploy directory lets you put a pre-packaged application into use immediately, with minimal effort.

  1. Find as-install/samples/quickstart/hello.war or download from http://glasfish.dev.java.net/downloads/quickstart/hello.war.

  2. Copy hello.war to the as-install/domains/domain1/autodeploy/ directory.


    Tip –

    On Windows, you can create a shortcut to the autodeploy directory on your desktop, and then drag and drop the hello.war file onto the shortcut.


    When the server has finished deploying the application, it creates a file named hello.war_deployed in the autodeploy directory. Depending on the speed of your system, the process can take a few seconds. Until that file appears, a 404-File Not Found error occurs when you try to visit the application page.

  3. Access this URL to visit the application page: http://localhost:4848/hello.

    You see the application’s first page, which prompts you to fill in your name:

    Displays message: Hi, my name is Duke. What's yours?
  4. Type your name and click Submit.

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

ProcedureTo Deploy the Hello Application Using Admin Console

  1. Open http://localhost:4848/asadmin in a web browser.

    • localhost is used if the both the browser and the Application Server are running on the same system. If the Application Server is running on another system, substitute the name of that system in the URL.

    • 4848 is the Admin Console’s default port number. If you changed the port number during the installation, use that number instead.

  2. Enter the admin user name and password.

  3. In the left pane, click the Applications node to expand it.

  4. Click Web Applications.

    You can see the list of deployed web applications, if any.

  5. If you already have a Hello application deployed, undeploy it now by selecting the checkbox next to it and clicking Undeploy.

  6. Click Deploy.

  7. You can use the Hello application bundled with the Application Server or you upload the sample you have downloaded from http://glasfish.dev.java.net/downloads/quickstart/hello.war. Do one of the following:

    • Select the option called Local packaged file or directory that is accessible to Application Server and click Browse Files. Navigate to the as-install/samples/quickstart directory and select hello.war.

  8. If you have downloaded the Hello application Select the Package file to upload to the Application Server option and click Browse. Navigate to the directory to which you have downloaded the application.

  9. Click OK.

    The application appears in the Web Applications list.

  10. To verify that it was deployed properly, in the Web Applications page, select the Hello application and click Launch.

Deploying Applications Using CLI Commands

You can deploy applications using the asadmin deploy command. See deploy(1) in the Sun Java System Application Server 9.1 Reference Manual. You can also use the asant commands for deployment. For detailed information on deploying applications see Deploying Modules and Applications in Sun Java System Application Server 9.1 Application Deployment Guide.