Oracle GlassFish Server 3.1 Embedded Server Guide
Introduction to Embedded GlassFish Server
Including the GlassFish Server Embedded Server API in Applications
Creating, Starting, and Stopping Embedded GlassFish Server
Creating and Configuring an Embedded GlassFish Server
Running an Embedded GlassFish Server
Setting the Port of an Embedded GlassFish Server From an Application
Starting an Embedded GlassFish Server From an Application
Stopping an Embedded GlassFish Server From an Application
Deploying and Undeploying an Application in an Embedded GlassFish Server
To Deploy an Application From an Archive File or a Directory
Creating a Scattered Enterprise Archive
Running asadmin Commands Using the GlassFish Server Embedded Server API
Using the EJB 3.1 Embeddable API with Embedded GlassFish Server
To Use the EJB 3.1 Embeddable API with Embedded GlassFish Server
EJB 3.1 Embeddable API Properties
Default Java Persistence Data Source for Embedded GlassFish Server
The following Embedded GlassFish Server directories and files are important:
The installation root directory, represented as as-install, is the parent of the directory that embedded GlassFish Server uses for configuration files. This directory corresponds to the base directory for an installation of GlassFish Server. Configuration files are contained in the following directories in the base directory for an installation of GlassFish Server:
domains
lib
The instance root directory, represented as domain-dir, is the parent directory of a server instance directory. Embedded Oracle GlassFish Server uses the server instance directory for domain configuration files.
If domain-dir is not specified, GlassFish Server creates a directory named gfembedrandom-numbertmp in a temporary directory, where random-number is a randomly generated 19-digit number. GlassFish Server then copies configuration files into this directory. The temporary directory is the value of the system property java.io.tmpdir. You can override this value by specifying the glassfish.embedded.tmpdir property as a system property.
Using an existing domain.xml file avoids the need to configure embedded GlassFish Server programmatically in your application. Your application obtains domain configuration data from an existing domain.xml file. You can create this file by using the administrative interfaces of an installation of nonembedded GlassFish Server.
Note - The built-in domain.xml file used by default by Embedded GlassFish Server can be downloaded from http://embedded-glassfish.java.net/domain.xml.