Sun GlassFish Enterprise Server v3 Preview Quick Start Guide
Sun GlassFishTM Enterprise Server (GlassFish server) v3 Preview 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 Center connectivity
This document provides the following topics:
How This Quick Start Guide Works
The Sun GlassFish Enterprise Server v3 Preview Quick Start Guide enables you to quickly learn the basics about key GlassFish server features.
Step-by-step procedures introduce you to product features and allow you to learn about and use them immediately.
Throughout this document, the installation directory is referred to as as-install. The instructions and examples 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® systems, Linux, or MacOS X systems: as-install/bin/asadmin
Windows systems or Mac OS X systems: as-install \bin\asadmin
This document provides fundamental information only. For comprehensive information about GlassFish server or other entities mentioned in this document, see For More Information.
To read additional details about this release before you begin using the software, review the Sun GlassFish Enterprise Server v3 Preview Release Notes. The Release Notes provide recent information, limitations, 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 Preview documentation collection.
Starting and Stopping the Default Domain
When you install GlassFish server, a default domain named domain1 is created.
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 show the status of domains (running or not), use the 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 you have applications that need a database back end, you must start and stop the database server manually.
To Start the Sun GlassFish Java DB Server
The instructions in this procedure describe how to start the JavaTM DB server that is bundled with GlassFish server, but they apply for the most part to any database you want to use.
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/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 and your domains.
To Launch the Administration Console
Before You Begin
At least one GlassFish server domain must be started before you launch the Administration Console.
- To open the Administration Console, type the URL in a browser window.
The default URL for the Administration Console is:
http://localhost:4848
- If prompted, log in to the Administration Console.
By default, the user name is anonymous and the Password field is left blank (no password).
See Also
Refer to the Administration Console online help for additional information.
Deploying and Undeploying Applications
The process of configuring and enabling an application to run within the GlassFish server framework is referred to as deployment.
This section explains how to deploy, list, and undeploy applications.
Obtaining a Sample Application
The procedures in this section use the hello.war application.
To 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.
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.
- 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
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?
- 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 Preview 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.
- Open the Administration Console by typing the following URL in a browser
window:
http://localhost:4848
- Click the Applications node in the tree on the left.
The Applications page is displayed.
- Click Deploy.
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 then 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.
- Click the Launch link on the Applications page to run the
sample 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
- Open the Administration Console by typing the following URL in a browser
window:
http://localhost:4848
- 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
- Open the Administration Console by typing the following URL in a browser
window:
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 sample application.
- Remove or disable the application.
- To remove the application, click Undeploy.
- To disable the application, click Disable.
See Also
Refer to the Administration Console online help for additional information.
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.
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
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.
To Undeploy the Sample Application Automatically
- Use the cd command to change to the domain's autodeploy directory.
cd as-install/domains/domain-name /autodeploy
- Use the rm command to undeploy and remove the application.
rm hello.war
(Use del instead of rm on Windows systems.)
Removing GlassFish Server v3 Preview Software
Uninstall GlassFish server if you no longer want to use the software.
To Remove GlassFish Server Software
Before You Begin
Stop all GlassFish server processes that are running (domains and other related processes, command prompts using the installation directory or its subdirectories, and so on).
- Change to the directory where GlassFish server v3 Preview is installed (referred to as as-install throughout this document).
- Run the uninstallation command.
- Solaris, Linux or MacOS X systems: From the command line, type the
following command:
./uninstall.sh
- Windows systems: Double-click the uninstall.exe file.
- Solaris, Linux or MacOS X systems: From the command line, type the
following command:
- Examine the installation directory contents and remove any remaining files or directories that you do not want.
For More Information
This section provides links to helpful resources and includes the following:
Many other add-on components for GlassFish server v3 Preview are available through Update Tool.
Your First Cup
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 is a web application that consists of a JavaServer FacesTM-managed bean, a JAX-RS web service, and a Facelet web front end.
Java EE 6 Tutorial, Volume I
The Java EE 6 Tutorial, Volume I provides a 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, and more. The document is also available through the Update Tool.
Java EE 6 Samples
The sample applications demonstrate Java EE 6 technologies. The sample applications are available in as-install/bin.
Product Documentation
Sun GlassFish Enterprise Server Preview v3 Release Notes: Recent information, limitations, and tips for installing and working with GlassFish server.
GlassFish server documentation: Collection of guides that document GlassFish server features and functions.
GlassFish server screencasts: Collection of video recordings that demonstrate numerous features and examples for working with GlassFish server and related projects.
GlassFish server FAQs: Frequently asked questions covering various GlassFish server topics.
GlassFish Communities
Glass Fish User Forum: Public online discussions that provide community support and tips for working with GlassFish server.
GlassFish Wiki: Open source development community site that provides a wide range of information related to GlassFish server.
GlassFish Documentation project: Open source Documentation community site that provides details about GlassFish server documentation and how you can participate.
GlassFish Quality Community: Open source Quality community focused on testing and improving GlassFish server.