JavaScript is required to for searching.
Skip Navigation Links
Exit Print View
Oracle GlassFish Server 3.1 Administration Guide
search filter icon
search icon

Document Information

Preface

1.  Overview of GlassFish Server Administration

Default Settings and Locations

Configuration Tasks

Administration Tools

Instructions for Administering GlassFish Server

Part I Runtime Administration

2.  General Administration

3.  Administering Domains

About Administering Domains

GlassFish Server Instances

Domains for Administering GlassFish Server

Domain Administration Server (DAS)

Creating, Logging In To, and Deleting a Domain

To Create a Domain

To Create a Domain From a Custom Template

To List Domains

To Log In to a Domain

To Delete a Domain

Starting and Stopping a Domain

To Start a Domain

To Stop a Domain

To Restart a Domain

Configuring a DAS or a GlassFish Server Instance for Automatic Restart

To Configure a DAS or an Instance for Automatic Restart on Windows

To Configure a DAS or an Instance for Automatic Restart on Linux

To Configure a DAS or an Instance for Automatic Restart on Oracle Solaris

To Prevent Service Shutdown When a User Logs Out on Windows

Suspending and Resuming a Domain

To Suspend a Domain

To Resume a Domain

Setting Up Automatic Backups of a Domain

To Create a Backup Configuration

To List Backup Configurations

To Enable a Backup Configuration

To Disable a Backup Configuration

To Delete a Backup Configuration

To Create a Schedule

To List Schedules

To Delete a Schedule

Backing Up and Restoring a Domain

To Back Up a Domain

To Restore a Domain

To List Domain Backups

Re-Creating the Domain Administration Server (DAS)

To Migrate the DAS

Additional Domain Tasks

To Display Domain Uptime

To Switch a Domain to Another Supported Java Version

To Change the Administration Port of a Domain

4.  Administering the Virtual Machine for the Java Platform

5.  Administering Thread Pools

6.  Administering Web Applications

7.  Administering the Logging Service

8.  Administering the Monitoring Service

9.  Writing and Running JavaScript Clients to Monitor GlassFish Server

10.  Administering Life Cycle Modules

11.  Extending and Updating GlassFish Server

Part II Resources and Services Administration

12.  Administering Database Connectivity

13.  Administering EIS Connectivity

14.  Administering Internet Connectivity

15.  Administering the Object Request Broker (ORB)

16.  Administering the JavaMail Service

17.  Administering the Java Message Service (JMS)

18.  Administering the Java Naming and Directory Interface (JNDI) Service

19.  Administering Transactions

Part III Appendixes

A.  Subcommands for the asadmin Utility

Index

Creating, Logging In To, and Deleting a Domain

The following topics are addressed here:

To Create a Domain

After installing GlassFish Server and creating the default domain (domain1), you can create additional domains by using the local create-domain subcommand. This subcommand creates the configuration of a domain. Any user who has access to the asadmin utility on a given system can create a domain and store the domain configuration in a folder of choice. By default, the domain configuration is created in the default directory for domains. You can override this location to store the configuration elsewhere.

You are required to specify an administrative user when you create a domain, or you can accept the default login identity which is username admin with no password.

  1. Select a name for the domain that you are creating.

    You can verify that a name is not already in use by using the list-domains(1) subcommand

  2. Create a domain by using the create-domain(1) subcommand.

    Information about the options for this subcommand is included in this help page.

  3. Type an admin user name and password for the domain.

    To avoid setting up an admin login, you can accept the default admin, with no password. Pressing Return also selects the default.

Example 3-1 Creating a Domain

This example creates a domain named domain1 . When you type the command, you might be prompted for login information.

asadmin> create-domain --adminport 4848 domain1
Enter admin user name[Enter to accept default]>
Using port 4848 for Admin.
Default port 8080 for HTTP Instance is in use. Using 1161
Using default port 7676 for JMS.
Using default port 3700 for IIOP.
Using default port 8081 for HTTP_SSL.
Using default port 3820 for IIOP_SSL.
Using default port 3920 for IIOP_MUTUALAUTH.
Default port 8686 for JMX_ADMIN is in use. Using 1162
Distinguished Name of the self-signed X.509 Server Certificate is:
[CN=moonbeam.gateway.2wire.net,OU=GlassFish,O=Oracle Corp.,L=Redwood Shores,ST
California,C=US]
Domain domain1 created.
Command create-domain executed successfully.

To start the Administration Console in a browser, enter the URL in the following format:

http://hostname:5000

For this example, the domain’s log files, configuration files, and deployed applications now reside in the following directory:

domain-root-dir/mydomain

See Also

You can also view the full syntax and options of the subcommand by typing asadmin help create-domain at the command line.

To Create a Domain From a Custom Template

A custom template enables you to customize the configuration of any domain that you create from the template.

  1. Create a domain to use as the basis for the template.

    For more information, see To Create a Domain.

  2. Use the asadmin utility or the Administration Console to configure the domain.

    Your configuration changes will be included in the template that you create from the domain.

  3. Copy the domain's domain.xml file under a new name to the as-install/lib/templates directory.

    A domain's domain.xml file is located in the domain-dir/config directory.

  4. In a plain text editor, edit the file that you copied to replace with tokens values that are to be substituted when a domain is created.

    Each token is identified as %%%token-name%%%, where token-name is one of the following names:

    ADMIN_PORT

    Represents the port number of the HTTP port or the HTTPS port for administration. This token is replaced with one of the following values in the command to create a domain from the template:

    • The value of the --adminport option

    • The value of the domain.adminPort property

    CONFIG_MODEL_NAME

    Represents the name of the configuration that is created for the domain that is being created. This token is replaced with the string server-config.

    DOMAIN_NAME

    Represents the name of the domain that is being created. This token is replaced with the operand of create-domain subcommand.

    HOST_NAME

    Represents the name of the host on which the domain is being created. This token is replaced with the fully qualified host name of the host where the domain is being created.

    HTTP_PORT

    Represents the port number of the port that is used to listen for HTTP requests. This token is replaced with one of the following values in the command to create a domain from the template:

    • The value of the --instanceport option

    • A value that the create-domain subcommand calculates from the value of the --portbase option

    • The value of the domain.instancePort property

    HTTP_SSL_PORT

    Represents the port number of the port that is used to listen for secure HTTP requests. This token is replaced with one of the following values in the command to create a domain from the template:

    • A value that the create-domain subcommand calculates from the value of the --portbase option

    • The value of the http.ssl.port property

    JAVA_DEBUGGER_PORT

    Represents the port number of the port that is used for connections to the Java Platform Debugger Architecture (JPDA) debugger. This token is replaced with one of the following values in the command to create a domain from the template:

    • A value that the create-domain subcommand calculates from the value of the --portbase option

    • The value of the java.debugger.port property

    JMS_PROVIDER_PORT

    Represents the port number for the Java Message Service provider. This token is replaced with one of the following values in the command to create a domain from the template:

    • A value that the create-domain subcommand calculates from the value of the --portbase option

    • The value of the jms.port property

    JMX_SYSTEM_CONNECTOR_PORT

    Represents the port number on which the JMX connector listens. This token is replaced with one of the following values in the command to create a domain from the template:

    • A value that the create-domain subcommand calculates from the value of the --portbase option

    • The value of the domain.jmxPort property

    ORB_LISTENER_PORT

    Represents the port number of the port that is used for IIOP connections. This token is replaced with one of the following values in the command to create a domain from the template:

    • A value that the create-domain subcommand calculates from the value of the --portbase option

    • The value of the orb.listener.port property

    ORB_MUTUALAUTH_PORT

    Represents the port number of the port that is used for secure IIOP connections with client authentication. This token is replaced with one of the following values in the command to create a domain from the template:

    • A value that the create-domain subcommand calculates from the value of the --portbase option

    • The value of the orb.mutualauth.port property

    ORB_SSL_PORT

    Represents the port number of the port that is used for secure IIOP connections. This token is replaced with one of the following values in the command to create a domain from the template:

    • A value that the create-domain subcommand calculates from the value of the --portbase option

    • The value of the orb.ssl.port property

    OSGI_SHELL_TELNET_PORT

    Represents the port number of the port that is used for connections to the Apache Felix Remote Shell. This shell uses the Felix shell service to interact with the OSGi module management subsystem. This token is replaced with one of the following values in the command to create a domain from the template:

    • A value that the create-domain subcommand calculates from the value of the --portbase option

    • The value of the osgi.shell.telnet.port property

    SERVER_ID

    Represents the name of the DAS for the domain that is being created. This token is replaced with the string server.


    Tip - For information about how these tokens are used in the default template, examine the as-install/lib/templates/domain.xml file.


  5. Create the domain that you want to be based on a custom template.

    In the command to create the domain, pass the name of file that you edited in the previous step as the --template option of the create-domain(1) subcommand.

  6. Before starting the domain, verify that the domain's domain.xml file is valid.

    Use the verify-domain-xml(1) subcommand for this purpose.

    Information about the options for this subcommand is included in the subcommand's help page.

See Also

You can also view the full syntax and options of the subcommands by typing the following commands at the command line.

To List Domains

Use the list-domains subcommand to display a list of domains and their statuses. If the domain directory is not specified, the contents of the default as-install/domains directory is listed. If there is more than one domain, the domain name must be specified.

To list domains that were created in other directories, specify the --domaindir option.

Example 3-2 Listing Domains

This example lists the domains in the default as-install/domains directory:

asadmin> list-domains
Name: domain1 Status: Running
Name: domain4 Status: Not Running
Name: domain6 Status: Not Running
Command list-domains executed successfully.

See Also

You can also view the full syntax and options of the subcommand by typing asadmin help list-domain at the command line.

To Log In to a Domain

All remote subcommands require that credentials be specified in terms of an administration user name and its password. By default, the domain is created with an identity that allows an asadmin user to perform administrative operations when no identity is explicitly or implicitly specified.

The default identity is in the form of a user whose name is admin and has no password. If you specify no user name on the command line or on prompt, and specify no password in the --passwordfile option or on prompt, and you have never logged in to a domain using either the login subcommand or the create-domain subcommand with the ----savelogin option, then the asadmin utility will attempt to perform a given administrative operation without specifying any identity.

A server (domain) allows administrative operations to be run using this default identity if the following conditions are true:

By default, all of these conditions are true, unless you have created the domain with a specific user name and password. Thus, by default, the only administrative user is admin with no password.

Use the login subcommand in local mode to authenticate yourself (log in to) a specific domain. After such login, you do not need to specify the administration user or password for subsequent operations on the domain. The login subcommand can only be used to specify the administration password. For other passwords that remote subcommands require, use the --passwordfile option, or specify the password at the command prompt. You are always prompted for the administration user name and password.

There is no logout subcommand. If you want to log in to another domain, invoke asadmin login with new values for --host and --port.

  1. Determine the name of the domain that you are logging in to.

    To list the existing domains:

    asadmin list-domains
  2. Log in to the domain by using the login(1)command.

Example 3-3 Logging In To a Domain on a Remote Machine

This example logs into a domain located on another machine. Options are specified before the login subcommand.

asadmin> --host foo --port 8282 login
Please enter the admin user name>admin Please enter the admin password> 
Trying to authenticate for administration of server at host [foo] and port [8282] ... 
Login information relevant to admin user name [admin] 
for host [foo] and admin port [8282] stored at [/.asadminpass] successfully. 
Make sure that this file remains protected. Information stored in this
file will be used by asadmin commands to manage associated domain.

Example 3-4 Logging In to a Domain on the Default Port of Localhost

This example logs into a domain on myhost on the default port. Options are specified before the login subcommand.

asadmin>  --host myhost login Please enter the admin user name>admin Please enter the admin password> 
Trying to authenticate for administration of server at host [myhost] and port [4848] ... 
An entry for login exists for host [myhost] and port [4848], probably from 
an earlier login operation. 
Do you want to overwrite this entry (y/n)?y 
Login information relevant to admin user name [admin] for host [myhost] 
and admin port [4848] stored at [/home/joe/.asadminpass] successfully. 
Make sure that this file remains protected. Information stored in this file will be used by 
asadmin commands to manage associated domain.

See Also

You can also view the full syntax and options of the subcommand by typing asadmin help login at the command line. For additional information about passwords, see Administering Passwords in Oracle GlassFish Server 3.1 Security Guide.

To Delete a Domain

Use the delete-domain subcommand to delete an existing domain from a server. Only the root user or the operating system user who is authorized to administer the domain can run this subcommand.

Before You Begin

A domain must be stopped before it can be deleted.

  1. List domains by using the list-domains(1) subcommand.
  2. If necessary, notify domain users that the domain is being deleted.
  3. Ensure that the domain you want to delete is stopped.

    If needed, see To Stop a Domain.

  4. Delete the domain by using the delete-domain(1) subcommand.

Example 3-5 Deleting a Domain

This example deletes a domain named domain1 from the location specified.

asadmin> delete-domain --domaindir ..\domains domain1
Domain domain1 deleted.
Command delete-domain executed successfully.

See Also

You can also view the full syntax and options of the subcommand by typing asadmin help delete-domain at the command line.