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

Configuring a DAS or a GlassFish Server Instance for Automatic Restart

Use the create-service subcommand in local mode to configure your system to automatically restart a domain administration server (DAS) or a GlassFish Server instance. GlassFish Server enables you to configure a DAS or an instance for automatic restart on the following operating systems:

To ensure that automatic restart functions correctly on Windows, you must prevent service shutdown when a user logs out.

The following topics are addressed here:

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

On Windows systems, the create-service subcommand creates a Windows service to represent the DAS or instance. The service is created in the disabled state. After this subcommand creates the service, you must use the Windows Services Manager or the Windows Services Wrapper to start, stop, uninstall, or install the service. To administer the service from the Windows command line, use the sc.exe tool.

This subcommand must be run as the OS-level administrator user.

  1. Create the service by using the create-service(1) subcommand.
  2. After the service is created, start the service by using the Windows Services Manager or the Windows Services Wrapper.

    For example, to start the service for the default domain by using the sc.exe tool, type:

    C:\> sc start domain1

    If you are using the sc.exe tool to administer the service, use the tool as follows:

    • To obtain information about the service, use the sc query command.

    • To stop the service, use the sc stop command.

    • To uninstall the service, use the sc delete command.

Example 3-10 Creating a Service to Restart a DAS Automatically on Windows

This example creates a service for the default domain on a system that is running Windows.

asadmin> create-service
Found the Windows Service and successfully uninstalled it.
The Windows Service was created successfully.  It is ready to be started.  Here are 
the details:
ID of the service: domain1
Display Name of the service:domain1 GlassFish Server
Domain Directory: C:\glassfishv3\glassfish\domains\domain1
Configuration file for Windows Services Wrapper: C:\glassfishv3\glassfish\domains\
domain1\bin\domain1Service.xml
The service can be controlled using the Windows Services Manager or you can use the
Windows Services Wrapper instead:
Start Command:  C:\glassfishv3\glassfish\domains\domain1\bin\domain1Service.exe  start
Stop Command:   C:\glassfishv3\glassfish\domains\domain1\bin\domain1Service.exe  stop
Uninstall Command:  C:\glassfishv3\glassfish\domains\domain1\bin\domain1Service.exe
uninstall
Install Command:  C:\glassfishv3\glassfish\domains\domain1\bin\domain1Service.exe
install

This message is also available in a file named PlatformServices.log in the domain's 
root directory
Command create-service executed successfully.

Example 3-11 Querying the Service to Restart a DAS Automatically on Windows

This obtains information about the service for the default domain on a system that is running Windows.

C:\> sc query domain1

SERVICE_NAME: domain1
        TYPE               : 10  WIN32_OWN_PROCESS
        STATE              : 1  STOPPED
        WIN32_EXIT_CODE    : 1077  (0x435)
        SERVICE_EXIT_CODE  : 0  (0x0)
        CHECKPOINT         : 0x0
        WAIT_HINT          : 0x0

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

On Linux systems, the create-service subcommand creates a System-V-style initialization script /etc/init.d/GlassFish_domain-or-instance-name and installs a link to this script in any /etc/rcN.d directory that is present, where N is 0, 1, 2, 3, 4, 5, 6, and S. After this subcommand creates the script, you must use this script to start, stop, or restart the domain or instance.

The script automatically restarts the domain or instance only during a reboot. If the domain or instance is stopped, but the host remains running, the domain or instance is not restarted automatically. To restart the domain or instance, you must run the script manually.

You might no longer require the domain or instance to be automatically restarted during a reboot. In this situation, use the operating system to delete the initialization script and the link to the script that the create-service subcommand creates.

The create-service subcommand must be run as the OS-level root user.

Example 3-12 Creating a Service to Restart a DAS Automatically on Linux

This example creates a service for the default domain on a system that is running Linux.

asadmin> create-service
Found the Linux Service and successfully uninstalled it.
The Service was created successfully. Here are the details:
Name of the service:domain1
Type of the service:Domain
Configuration location of the service:/etc/init.d/GlassFish_domain1
User account that will run the service: root
You have created the service but you need to start it yourself.  
Here are the most typical Linux commands of interest:

* /etc/init.d/GlassFish_domain1 start
* /etc/init.d/GlassFish_domain1 stop
* /etc/init.d/GlassFish_domain1 restart

For your convenience this message has also been saved to this file: 
/export/glassfish3/glassfish/domains/domain1/PlatformServices.log
Command create-service executed successfully.

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

On Oracle Solaris systems, the create-service subcommand creates an Oracle Solaris Service Management Facility (SMF) service that restarts a DAS or an instance. The service grants to the process the privileges of the user that runs the process. When you create an SMF service, the default user is the superuser. If you require a different user to run the process, specify the user in method_credential.

If your process is to bind to a privileged port of Oracle Solaris, the process requires the net_privaddr privilege. The privileged ports of the Oracle Solaris operating system have port numbers less than 1024.

To determine if a user has the net_privaddr privilege, log in as that user and type the command ppriv -l | grep net_privaddr.

After you create and enable the SMF service, if the domain or instance is stopped, SMF restarts it.

Before You Begin

To run the create-service subcommand, you must have solaris.smf.* authorization. For information about how to set the authorizations, see the useradd(1M) man page and the usermod(1M) man page. You must also have write permission in the directory tree: /var/svc/manifest/application/SUNWappserver. Usually, the superuser has both of these permissions. Additionally, Oracle Solaris administration commands such as svccfg(1M), svcs(1), and auths(1) must be available in the PATH.

If a particular GlassFish Server domain or instance should not have default user privileges, modify the manifest of the service and reimport the service.

  1. Create the service by using the create-service(1) subcommand.
  2. After the service is created, enable the service by using the svacdm enable command.

    For example, to enable the SMF service for the default domain, type:

    svacdm enable /appserver/domains/domain1

Example 3-13 Creating a Service to Restart a Domain Automatically on Oracle Solaris

This example creates a service for the default domain on a system that is running Oracle Solaris.

asadmin> create-service
The Service was created successfully. Here are the details:
Name of the service:application/GlassFish/domain1
Type of the service:Domain
Configuration location of the service:/home/gfuser/glassfish-installations
/glassfishv3/glassfish/domains
Manifest file location on the system:/var/svc/manifest/application
/GlassFish/domain1_home_gfuser_glassfish-installations_glassfishv3
_glassfish_domains/Domain-service-smf.xml.
You have created the service but you need to start it yourself.
Here are the most typical Solaris commands of interest:
* /usr/bin/svcs -a | grep domain1 // status
* /usr/sbin/svcadm enable domain1 // start
* /usr/sbin/svcadm disable domain1 // stop
* /usr/sbin/svccfg delete domain1 // uninstall
Command create-service executed successfully

See Also

For information about administering the service, see the following Oracle Solaris documentation:

To Prevent Service Shutdown When a User Logs Out on Windows

By default, the Java Virtual Machine (VM) receives signals from Windows that indicate that Windows is shutting down, or that a user is logging out of Windows, which causes the system to shut itself down cleanly. This behavior causes the GlassFish Server service to shut down. To prevent the service from shutting down when a user logs out, you must set the -Xrs Java VM option.

  1. Ensure that the DAS is running.
  2. Set the -Xrs Java VM option for the DAS.

    Use the create-jvm-options(1) subcommand for this purpose.

    asadmin> create-jvm-options -Xrs
  3. Set the -Xrs Java VM option for the Java VM within which the asadmin utility runs.

    To set this option, edit the asadmin.bat file to add the -Xrs option to the line that runs the admin-cli.jar file.

    • In the as-install\bin\asadmin.bat file, edit the line to read as follows:
      %JAVA% -Xrs -jar "%~dp0..\modules\admin-cli.jar" %*
    • In the as-install-parent\bin\asadmin.bat file, edit the line to read as follows:
      %JAVA% -Xrs -jar "%~dp0..\glassfish\modules\admin-cli.jar" %*
  4. If the GlassFish Server service is running, restart the service for your changes to take effect.