Sun GlassFish Enterprise Server v3

# Sun GlassFish Enterprise Server v3 Quick Start Guide

Sun GlassFishTM Enterprise Server (GlassFish server) v3 provides a server for the development and deployment of JavaTM Platform, Enterprise Edition (Java EE platform) applications and web technologies based on Java technology. GlassFish server v3 provides the following:

- A lightweight and extensible core based on OSGi Alliance standards

- A web and scripting container

- An easy-to-use Administration Console for configuration and management

- Update Tool connectivity for updates and add-on components

The following topics are addressed in this guide:

- About This Quick Start Guide

- Default Paths and File Names

- Default Administration Values

- Starting and Stopping the Default Domain

- Starting and Stopping the Database Server

- Starting the Administration Console

- Deploying and Undeploying Applications

- Updating and Extending an Existing Installation

- Removing GlassFish Server v3 Software

- For More Information

## About This Quick Start Guide

The Sun GlassFish Enterprise Server v3 Quick Start Guide demonstrates key features of GlassFish server and enables you to quickly learn the basics. Step-by-step procedures introduce you to product features and enable you to learn about and use them immediately.

This guide assumes that you have already obtained and installed the GlassFish server v3 software. For more information about installing GlassFish server v3, see the Sun GlassFish Enterprise Server v3 Installation Guide.

The instructions and examples in this guide use the forward slash character (`/`) as path separators in all file and command names. Be sure to use the correct character for the system on which GlassFish server is installed. For example:

- UNIX®, Linux, or Mac OS X systems: ``as-install`/bin/asadmin`

- Windows systems: ``as-install`\bin\asadmin`

This guide provides basic information only. For comprehensive information about GlassFish server and other entities mentioned in this guide, see For More Information.

To review additional details about this release before you begin using the software, see the Sun GlassFish Enterprise Server v3 Release Notes. The Release Notes provide important information about the GlassFish server v3 release, including details about new features, information about known issues and possible workarounds, and tips for installing and working with GlassFish server software.

When this Quick Start Guide is updated, the most recent version is available in the GlassFish server v3 documentation collection.

## Default Paths and File Names

The following table lists the default paths and file names used in this guide and throughout GlassFish server documentation.

Placeholder | Description | Default Value
as-install | Represents the base installation directory for GlassFish server. In configuration files, as-install is represented as follows: `${com.sun.aas.installRoot}` | Installations on the SolarisTM operating system, Linux operating system, and Mac operating system: user’s-home-directory`/glassfishv3/glassfish` Windows, all installations: SystemDrive`:\glassfishv3\glassfish`
as-install-parent | Represents the parent of the base installation directory for GlassFish server. | Installations on the Solaris operating system, Linux operating system, and Mac operating system: user’s-home-directory`/glassfishv3` Windows, all installations: SystemDrive`:\glassfishv3`
domain-root-dir | Represents the directory in which a domain is created by default. | as-install`/domains/`
domain-dir | Represents the directory in which a domain's configuration is stored. In configuration files, domain-dir is represented as follows: `${com.sun.aas.instanceRoot}` | domain-root-dir`/`domain-name

## Default Administration Values

The following table lists default administration values for GlassFish server. See Default Paths and File Names for more information about the as-install and domain-dir placeholders.

Item | Default Value or Location
Domain name | `domain1`
Master password | `changeit`
Command-line utility (`asadmin`) | as-install`/bin`
Configuration files | domain-dir`/config`
Log files | domain-dir`/logs`
Administration server port | `4848`
HTTP port | `8080`
HTTPS port | `8181`
Pure JMX clients port | `8686`
Message Queue port | `7676`
IIOP port | `3700`
IIOP/SSL port | `3820`
IIOP/SSL port with mutual authentication | `3920`

## Starting and Stopping the Default Domain

When you install GlassFish server, a default domain named `domain1` is created. The following procedures describe how to start and stop `domain1` when it is the only domain. For information about starting and stopping a domain when there are multiple domains, see the Sun GlassFish Enterprise Server v3 Administration Guide.

### To Start the Default Domain

#### Before You Begin

GlassFish server software must be installed before you start the domain.

- To start the default domain, use the `start-domain` command:

      as-install/bin/asadmin start-domain

  The command starts the default domain, `domain1`.

### To Stop the Default Domain

- To stop the default domain, use the `asadmin stop-domain` command:

      as-install/bin/asadmin stop-domain

  The command stops the default domain, `domain1`.

  Tip - To determine whether a domain is running, use the `asadmin list-domains` command: ``as-install`/bin/asadmin list-domains`

## Starting and Stopping the Database Server

A database server is not started by default when you start the GlassFish server domain. If your applications require a database back end, you must start and stop the database server manually.

The following procedures describe how to start and stop the Java DB server that is bundled with GlassFish server. For information about starting and stopping other database servers, see the documentation for your specific product.

For the list of database products supported in this release, see the Sun GlassFish Enterprise Server v3 Release Notes. For more information about database connectivity, see the Sun GlassFish Enterprise Server v3 Administration Guide.

### To Start the Java DB Server

#### Before You Begin

At least one GlassFish server domain must be started before you start the database server.

- Use the `asadmin start-database` command.

  The general form for the command is:

      as-install/bin/asadmin start-database --dbhome directory-path

  For example, to start the Java DB server from its default location:

      as-install/bin/asadmin start-database --dbhome as-install-parent/javadb

### To Stop the Java DB Server

- Use the `asadmin stop-database` command:

      as-install/bin/asadmin stop-database

## Starting the Administration Console

The GlassFish server Administration Console provides a browser interface for configuring, administering, and monitoring GlassFish server.

### To Start the Administration Console

#### Before You Begin

At least one GlassFish server domain must be started before you start the Administration Console.

1. To start the Administration Console, type the URL in your browser.

   The default URL for the Administration Console is:

       http://localhost:4848

2. If prompted, log in to the Administration Console.

   You will be prompted to log in if you chose to require an administration password at the time GlassFish server was installed.

#### See Also

Refer to the Administration Console online help for additional information.

## Deploying and Undeploying Applications

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:

- Obtaining a Sample Application

- Deploying an Application From the Command Line

- Deploying an Application by Using the Administration Console

- Deploying an Application Automatically

### Obtaining a Sample Application

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

#### To Obtain the Sample Application

1. To download a copy of the `hello.war` sample application, go to https://glassfish.dev.java.net/downloads/quickstart/hello.war.
2. Save the `hello.war` file in the directory of your choice. This directory is referred to as sample-dir.

### Deploying an Application From the Command Line

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

#### To 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 GlassFish 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 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?

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 the Sun GlassFish Enterprise Server v3 Application Deployment Guide for more information about deploying applications from the command line.

#### To List Deployed Applications From the Command Line

- Use the `asadmin list-applications` command:

      as-install/bin/asadmin list-applications

#### To 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.

#### To 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 GlassFish server domain must be started before you deploy the sample application.

1. Launch the Administration Console by typing the following URL in your browser:

       http://localhost:4848

2. Click the Applications node in the tree on the left.

   The Applications page is displayed.

3. Click the Deploy button.

   The Deploy Applications or Modules page is displayed.

4. Select Packaged File to be Uploaded to the Server, and click Browse.
5. 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.

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

   `hello`

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

   You are returned to the Applications page.

8. 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/

#### See Also

Refer to the Administration Console online help for additional information.

#### To View Deployed Applications in the Administration Console

1. Launch the Administration Console by typing the following URL in your browser:

       http://localhost:4848

2. Click the Applications node in the tree on the left.

   The node expands to list deployed applications. The applications are also listed in the table on the Applications page.

#### To Undeploy the Sample Application From the Administration Console

1. Launch the Administration Console by typing the following URL in your browser:

       http://localhost:4848

2. Click the Applications node in the tree on the left.

   The Applications page is displayed.

3. Select the check box next to the `hello` sample application.
4. Remove or disable the application.
   - To remove the application, click the Undeploy button.
   - To disable the application, click the Disable button.

#### See Also

Refer to the Administration Console online help for additional information.

### Deploying an Application Automatically

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

#### To 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.

- 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/

#### To Undeploy the Sample Application Automatically

1. Change to the domain's `autodeploy` directory.

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

2. Use the `rm` command to undeploy and remove the application.

   `rm hello.war`

   Use `del` instead of `rm` on Windows systems.

## Updating and Extending an Existing Installation

GlassFish server provides an administrative tool called Update Tool that enables you to install updates and add-on components to your existing GlassFish server installation. Update Tool can be accessed as a standalone graphical tool from the command line or as a browser-based graphical tool from the Administration Console. For more information about Update Tool, see the Sun GlassFish Enterprise Server v3 Administration Guide.

### To Access the Graphical Update Tool From the Command Line

- Use the `updatetool` command:

      as-install-parent/bin/updatetool

  If Update Tool is not installed, you will be prompted to install it. Install the tool if desired, then use the `updatetool` command to start the tool. Extensive online help is available from the tool's Help menu.

#### See Also

A command-line interface is also available for Update Tool. The command-line interface uses the `pkg` command and enables you to perform most of the tasks provided by the graphical version. For more information about the `pkg` command, see the Sun GlassFish Enterprise Server v3 Administration Guide.

### To Access Update Tool Using the Administration Console

#### Before You Begin

At least one GlassFish server domain must be started before you launch the Administration Console.

1. Launch the Administration Console by typing the following URL in your browser:

       http://localhost:4848

2. Click the Update Tool node in the tree on the left.

#### See Also

Refer to the Administration Console online help for additional information.

Also see the Sun GlassFish Enterprise Server v3 Installation Guide.

## Removing GlassFish Server v3 Software

The following procedure describes how to remove the software using the command-line interface. For additional information about uninstalling the software, see the Sun GlassFish Enterprise Server v3 Installation Guide.

### To Remove GlassFish Server Software

#### Before You Begin

Stop all domains and all processes related to the installation, including prompts that use the installation directory or its subdirectories and any applications that use the Java EE platform files bundled with the product. Stop all Update Tool processes, including the Notifier process.

1. Change to as-install-parent, the directory that contains the uninstallation program.
2. Run the uninstallation command.
   - UNIX, Linux, or Mac OS X systems: Type `./uninstall.sh`
     If necessary, grant execute permissions to the uninstall file before executing it: `chmod +x ./uninstall.sh`
   - Windows systems: Type `uninstall.exe`
3. Not all files and directories are removed automatically. Examine the remaining contents and remove any files and directories that you do not want, including hidden directories prefixed with a dot.

## For More Information

Additional resources are available to help you learn more about and use GlassFish server v3 and related technologies.

The following resources are addressed here:

- Product Documentation

- GlassFish Communities

- Tutorials

- Java EE 6 Samples

### Product Documentation

Comprehensive product documentation is available and includes the following.

- Sun GlassFish Enterprise Server v3 Release Notes: Latest details about new features, known issues, and tips for installing and working with GlassFish server software.

- GlassFish Server Documentation: Collection of guides that document GlassFish server features and functions.

- GlassFish Server Screencasts: Collection of video recordings that demonstrate various features and provide examples for working with GlassFish server and related technologies.

- GlassFish Server FAQs: Frequently asked questions covering a variety of GlassFish server topics.

### GlassFish Communities

The following resources will help you connect with other users, learn more about GlassFish server, and get help if needed.

- GlassFish User Forum: Public online discussion forum that provides community support and tips for working with GlassFish server.

- GlassFish Wiki: Community site that provides a wide range of information related to GlassFish server.

- GlassFish Documentation Project: Documentation community site that provides details about GlassFish server documentation and how you can participate.

- GlassFish Quality Community: Quality community site focused on testing and improving GlassFish server.

### Tutorials

The following tutorials provide working examples and detailed instructions for creating enterprise applications for the Java EE 6 platform.

- Your First Cup: An Introduction to the Java EE Platform: Short tutorial for beginning Java EE programmers that shows how to develop a simple enterprise application from scratch. The sample application consists of four main components: a JAX-RS RESTful web service, an enterprise bean, a Java Persistence API entity, and a web application created with JavaServerTM Faces Facelets technology.

- The Java EE 6 Tutorial, Volume I: Beginner's guide to developing enterprise applications for the GlassFish server. The tutorial includes working examples and instructions for creating applications with Java EE 6 technologies, including Java Servlets, JavaServer Faces, Facelets, RESTful Web Services, Enterprise JavaBeansTM, Java Persistence API, Contexts and Dependency Injection for the Java EE platform, and more. The document is also available through Update Tool.

- The Java EE 6 Tutorial, Volume II: Advanced guide that builds on The Java EE 6 Tutorial, Volume I and contains advanced topics, additional technologies, and case studies. The document is available to registered users of GlassFish server.

### Java EE 6 Samples

The sample applications demonstrate Java EE 6 technologies and how to use them. The samples are available as part of the Java EE 6 SDK distributions. To obtain the samples, you must install the SDK. For more information and to download the samples, see the Java EE 6 SDK download page.

Company Info | Contact | Copyright 2009 Sun Microsystems