Glassfish server open source edition quick start guide

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

About This Quick Start Guide

Eclipse GlassFish Server 5.1 Quick Start Guide demonstrateskey features of the GlassFish Server product and enables you to quicklylearn the basics. Step-by-step procedures introduce you to productfeatures and enable you to use them immediately.

This guide assumes that you have already obtained and installed theGlassFish Server 5.1 software. For more information about installingGlassFish Server 5.1, see theGlassFish Server OpenSource Edition Installation Guide.

Instructions and examples in this guide that apply to all supportedoperating systems use the forward slash character (/) as pathseparators in all file names and commands. Ensure that you use thecorrect 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`binasadmin`

This guide provides basic information only. For comprehensiveinformation about GlassFish Server and other entities mentioned in thisguide, see For More Information.

To review additional details about this release before you begin usingthe software, see the GlassFish Server Open Source EditionRelease Notes. The Release Notes provide important information aboutthe GlassFish Server 5.1 release, including details about new features,information about known issues and possible workarounds, and tips forinstalling and working with GlassFish Server 5.1 software.

Oracle GlassFish Server 3.0.1 Quick Start Guide

Deploying and Undeploying Applications

The process of configuring and enabling applications to run within the GlassFish Server frameworkis referred to as deployment.

This section explains how to deploy, list, and undeploy applications.The following topics are addressed here:

Obtaining a Sample Application

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

ProcedureTo Obtain the Sample Application

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

  2. Save the hello.war file in the directoryof 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 asadmindeploy command.

ProcedureTo Deploy the Sample Application From the CommandLine

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 deploythe sample application.

  1. Use the asadmin deploy command.

    Thegeneral 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 thefollowing URL in your browser:

    http://localhost:8080/hello

    The application’s start page is displayed, and you are prompted to typeyour name.

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

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

See Also

See deploy(1) formore information about the deploy command.

See the Oracle GlassFish Server 3.0.1 Application Deployment Guide formore information about deploying applications from the command line.

ProcedureTo List Deployed Applications From the Command Line

  1. Use the asadmin list-applications command:

    as-install/bin/asadmin list-applications

ProcedureTo Undeploy the Sample Application From the CommandLine

  1. Use the asadmin undeploy command.

    Thegeneral 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) formore information about the undeploy command.

Deploying an Application Using the Administration Console

You can deploy applications by using the graphical Administration Console.

ProcedureTo Deploy the Sample Application Using 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 deploythe sample application.

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

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

    TheApplications page is displayed.

  3. Click the Deploy button.

    The Deploy Applications orModules 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 DeployApplications or Modules page.

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

    hello

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

    Youare returned to the Applications page.

  8. Select the check box next to the hello applicationand 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.

ProcedureTo View Deployed Applications in the Administration Console

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

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

    Expandthe node to list deployed applications. Deployed applications are also listedin the table on the Applications page.

ProcedureTo Undeploy the Sample Application Using the Administration Console

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

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

    TheApplications page is displayed.

  3. Select the check box next to the hello sampleapplication.

  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 automaticdeployment. For this example, use the default domain, domain1:

as-install/domains/domain1/autodeploy

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. 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 onWindows systems.

    GlassFish Server automatically discovers and deploys the application. Thedefault URL for the application is:

    http://localhost:8080/hello/

ProcedureTo 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 theapplication.

    rm hello.war

    Use del instead of rm onWindows systems.

These installation instructions describe how to install Java Platform, Enterprise Edition 6 SDK Update 4 and Java Platform, Enterprise Edition 6 Web Profile SDK Update 4. The following topics are discussed:

Solaris, Linux, and Mac OS X installations support root/superuser and non-root/standard user installations. For Windows installations, users should have Power User or Administrator access.

Distributions and Their Components

The following distributions are available and include the components listed:

  • Java Platform, Enterprise Edition 6 (Java EE 6) SDK Update 4
    • GlassFish Server Open Source Edition 3.1.2
    • Your First Cup: An Introduction to the Java EE Platform
    • Java EE 6 Samples
    • Java EE 6 API Documentation
    • Java EE 6 Tutorial
  • Java Platform, Enterprise Edition 6 (Java EE 6) Web Profile SDK Update 4
    • GlassFish Server Open Source Edition 3.1.2 Web Profile
    • Your First Cup: An Introduction to the Java EE Platform
    • Java EE 6 Samples
    • Java EE 6 API Documentation
    • Java EE 6 Tutorial

Visit the Java EE 6 SDK Downloads page for more information about each distribution.

Preconfigured Repositories

The functionality offered by The Java EE 6 SDK Update 4 is organized into OSGi modules, or bundles, that are available as components through the image packaging system (IPS). When you install the SDK, it is preconfigured to use several IPS repositories that together house the OSGi modules available in the SDK. These preconfigured repositories are:

Repository URLDescriptionAuthoritypkg.oracle.com/javaeesdk/6/release/This is the preferred repository. This repository will host all FCS Java EE SDK packages.release.javaeesdk.oracle.compkg.oracle.com/glassfish/v3/contrib/This repository hosts all non-open source partner-contributed packages.contrib.glassfish.oracle.compkg.glassfish.org/v3/contrib/This repository hosts open source third party-contributed packages (from partners, etc.).contrib.glassfish.org

The first of these, pkg.oracle.com/javaeesdk/6/release/, has its publisher designated as the preferred publisher, and so is treated specially by the IPS tools:

  • If an add-on component is available from the preferred publisher as well as from other publishers, the Update Tool GUI and the pkg CLI will list and install the component from the preferred publisher.

  • Once a component has been installed from the preferred publisher, the Update Tool, Software Update, and desktop notifier GUIs will look for updates to that component only from the preferred publisher.

Installing the Software

Requirements

For a summary of supported platforms and the hardware and software requirements for this release, see the Java EE 6 SDK Update 4 Release Notes. Ensure that your system meets these requirements.

Java EE 6 SDK Update 4 distributions require JDK 6 or JDK 7.

Ensure that the required JDK software is installed on your system and that the JAVA_HOME environment variable points to the JDK installation directory, not the Java Runtime Environment (JRE) software.

For Mac OS X systems, the SDK uses the JDK that is part of the Macintosh operating system. However, OS X Lion does not provide a Java runtime by default. If necessary, obtain the required JDK version from the Apple Support Downloads site. (Search for the term “Java SE”.)

To Install the Software

The following procedure describes how to perform a Typical installation of the SDK distributions using the GUI-based installation wizard. To perform a Custom installation or to install using the non-interactive silent mode, see the GlassFish Server Open Source Edition 3.1.2 Installation Guide for detailed instructions.

  1. Download the distribution file for your platform from the Java EE 6 SDK Downloads page. The self-extracting file provides a graphical installation wizard.
  2. Navigate to the directory where you downloaded the file.
  3. Start the installation program:
    • Solaris, Linux, and Mac OS X systems:
      1. If necessary, grant execute permissions to the distribution file: chmod +x ./ distribution-filename
      2. At the command prompt, type: sh ./ distribution-filename
    • Windows systems: Double-click the executable .exe installation file.
  4. At the Introduction page of the installation wizard, click Next. Use the Next button to move through the installation process.
  5. Choose the Installation type.

    Choose a Typical Installation for application development purposes or non-production use only. Choose a Custom Installation if you are deploying GlassFish Server in a production environment.

    The remainder of this procedure describes the steps in the Typical Installation path. If you are performing a Custom Installation, skip the remainder of this procedure and follow the procedure explained in th “To Perform a Custom Installation” in the GlassFish Server Open Source Edition 3.1.2 Installation Guide.

  6. Specify the installation directory. This directory is referred to as install-dir and will be created if it does not exist.
  7. Specify whether to install Update Tool, an administrative tool that enables you to install updates and add-on components for GlassFish Server.
    • If you are not installing Update Tool, deselect the Install Update Tool check box. Update Tool can be installed later using the install-dir /bin/updatetool command.
    • If you are installing Update Tool and your system accesses the Internet through a proxy, specify the proxy host and proxy port.
    • If you want to install Update Tool but do not require the automatic notifications of available updates after installation, deselect the Enable Update Tool check box.
  8. Review the Ready To Install selections and click Install to proceed with the installation.

    The domain that was created by installation program is automatically started by the installer after the installation process completes.

  9. Review the Summary page. The page provides installation information and a link to the GlassFish Server Open Source Edition 3.1.2 Quick Start Guide. Make note of this information as desired, then click Exit.

    The names of the installation log and summary files are timestamp- install.log and timestamp- install-summary.html. On Solaris, Linux, and Mac OS X systems, these files are generated in the $TMP directory. On Windows systems, these files are generated in the %TEMP% directory.

Next Steps and Resources

The following resources will help you get started with GlassFish Server Open Source Edition and make the most of its capabilities.

  • Quick Start Guide. The Quick Start Guide helps you become familiar with GlassFish Server Open Source Edition and explains how to perform basic tasks such as starting the server, accessing the Administration Console, and deploying a sample application. The guide pertains to both GlassFish Server Open Source Edition and GlassFish Server Open Source Edition Web Profile.
  • Release Notes. The GlassFish Server Open Source Edition 3.1.2 Release Notes provide the latest information about GlassFish Server Open Source Edition, including what’s new, known issues, and pointers to additional resources.
  • Product Documentation. Detailed information about GlassFish Server Open Source Edition 3.1.2 is available in a ZIP file that includes all of the product documentation.
  • Update Tool. Update Tool enables you to install and update additional technologies and frameworks. Update Tool is installed with GlassFish Server and is accessed from the GlassFish Server Administration Console or from the command line.
  • Your First Cup: An Introduction to the Java EE Platform Your First Cup: An Introduction to the Java EE Platform provides a 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 JavaServer Faces Facelets technology.
  • Java EE 6 Samples. Java EE 6 samples demonstrate Java EE 6 technologies and help you learn more about them. After installation, samples are located in install-dir /glassfish /samples/javaee6. See the index.html file in that location for more information about the samples.
  • Java EE 6 API Documentation. Java EE 6 API documentation provides API reference documentation for GlassFish Server packages and related APIs. This documentation is generated from the source code by the Javadoc tool and after installation is accessed from install-dir /glassfish /docs /api /index.html.
  • The Java EE 6 Tutorial. The Java EE 6 Tutorial is a guide to developing enterprise applications for 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 JavaBeans, Java Persistence API, Contexts and Dependency Injection for the Java EE Platform, and more. The tutorial is also available through Update Tool.

Uninstalling the Software

Before you uninstall the software, make sure you have stopped all domains and other related processes, including command prompts using the installation directory or its subdirectories, the Update Tool notifier process if present, and any applications using Java SE files.

To stop domains, use the asadmin stop-domain command. For more information about this command, see the GlassFish Server Open Source Edition 3.1.2 Reference Manual in the product documentation ZIP file. To stop the Update Tool notifier process, use the updatetool --notifier --shutdown command, executed from install-dir /bin . If Update Tool is installed, the notifier is running by default.

If orphaned processes remain, identify and terminate the processes as follows:

  • Solaris, Linux, and Mac OS X systems: Use the ps -ef command and terminate the processes using the kill command.
  • Windows systems: Use the Task Manager and terminate the processes using the End Task or End Process buttons.

To Uninstall the Software

  1. Navigate to the installation directory.
  2. Start the uninstallation program:
    • Solaris, Linux, and Mac OS X systems:
      1. If necessary, grant execute permissions to the uninstall file: chmod +x uninstall.sh
      2. At the command prompt, type: ./uninstall.sh
    • Windows systems: From the Start menu, select Start, then Programs, then GlassFish Server Open Source Edition, then Uninstall.
  3. Review the Summary page that displays following uninstallation. The page provides summary details and log information. Make note of this information as desired, then click Exit.

    The names of the uninstallation log and summary files are timestamp- remove.log and timestamp- remove-summary.html. On Solaris, Linux, and Mac OS X systems, these files are generated in the $TMP directory. On Windows systems, these files are generated in the %TEMP% directory.

  4. The installation directory is not automatically removed by the uninstallation program. Examine the installation directory contents and remove any remaining files or directories that you do not want, including hidden directories prefixed with a dot ( . ) , for example. directory. It is safe to remove uninstallation and installation log files after you have examined them.
Written by Jane