Sun GlassFish Enterprise Server v3 Prelude Administration Guide

Chapter 4 Administering the Virtual Machine for the Java Platform

This chapter provides procedures for administering the Virtual Machine for the JavaTM platform (Java Virtual Machine) or JVMTM machine) in the Sun GlassFishTM Enterprise Server v3 Prelude environment by using the asadmin command-line utility.

The following topics are addressed here:

Instructions for accomplishing these tasks by using the Administration Console are contained in the Administration Console online help.

Administering JVM Options

The Java Virtual Machine is an interpretive computing engine responsible for running the byte codes in a compiled Java program. The virtual machine translates the Java byte codes into the native instructions of the host machine. Enterprise Server, being a Java process, requires a virtual machine to run and support the Java applications running on it. JVM settings are part of an Enterprise Server configuration.

The following instructions are used to administer the JVM options:

ProcedureTo Create JVM Options

The remote create-jvm-options command enables you to create JVM options in the Java configuration or the profiler elements of the domain.xml file. If JVM options are created for a profiler, these options are used to record the settings that initiate the profiler.

  1. Ensure that the server is running.

    Remote commands require a running server.

  2. Create JVM options by using the create-jvm-options(1) command.

    To create more than one JVM option, use a colon (:) to separate the options. If the JVM option itself contains a colon (:), use the backslash (\) to offset the colon delimiter.

  3. To apply your changes, restart Enterprise Server.

    1. Stop Enterprise Server.

      For instructions, see To Stop a Domain (or Server).

    2. Start Enterprise Server.

      For instructions, see To Start a Domain (or Server).


Example 4–1 Creating JVM Options


asadmin create-jvm-options -Dunixlocation=/root/
example:-Dvariable=\$HOME:-Dwindowslocation
=d\\:\\\sun\\\appserver:-Doption1=-value1

Information similar to the following is displayed:


created 4 option(s)
Command create-jvm-options executed successfully.

See Also

To see the full syntax and options of the command, type asadmin create-jvm-options --help at the command line.

ProcedureTo List JVM Options

The remote list-jvm-options command enables you to list the existing JVM options.

  1. Ensure that the server is running.

    Remote commands require a running server.

  2. List JVM options by using the list-jvm-options(1) command.


Example 4–2 Listing JVM Options

The following example command lists all JVM options:


asadmin list-jvm-options

Information similar to the following is displayed:


-Djava.security.auth.login.config=${com.sun.aas.instanceRoot}/config/login.conf
-XX: LogVMOutput
-XX: UnlockDiagnosticVMOptions
-Dcom.sun.enterprise.config.config_environment_factory_class=com.sun.enterprise.
config.serverbeans.AppserverConfigEnvironmentFactory
-Djavax.net.ssl.keyStore=${com.sun.aas.instanceRoot}/config/keystore.jks
-XX:NewRatio=2
-Djava.security.policy=${com.sun.aas.instanceRoot}/config/server.policy
-Djdbc.drivers=org.apache.derby.jdbc.ClientDriver
-Djavax.net.ssl.trustStore=${com.sun.aas.instanceRoot}/config/cacerts.jks
-client
-Djava.ext.dirs=${com.sun.aas.javaRoot}/lib/ext${path.separator}${com.sun.aas.ja
vaRoot}/jre/lib/ext${path.separator}${com.sun.aas.instanceRoot}/lib/ext${path.se
parator}${com.sun.aas.derbyRoot}/lib
-Xmx512m
-XX:LogFile=${com.sun.aas.instanceRoot}/logs/jvm.log
-Djava.endorsed.dirs=${com.sun.aas.installRoot}/lib/endorsed

Command list-jvm-options executed successfully.

See Also

To see the full syntax and options of the command, type asadmin list-jvm-options --help at the command line.

ProcedureTo Delete JVM Options

The remote delete-jvm-options command enables you to delete JVM options from the Java configuration or profiler elements of the domain.xml file.

  1. Ensure that the server is running.

    Remote commands require a running server.

  2. Obtain the exact name of the JVM option that you are deleting.

    To list the existing JVM options:


    asadmin list-jvm-options
    
  3. If necessary, notify users that the JVM option is being deleted.

  4. Delete JVM options by using the delete-jvm-options(1) command.

    To remove more than one JVM option, use a colon (:) to separate the options. If the JVM option itself contains a colon, use the backslash (\) to offset the colon delimiter.

  5. To apply your changes, restart Enterprise Server.

    1. Stop Enterprise Server.

      For instructions, see To Stop a Domain (or Server).

    2. Start Enterprise Server.

      For instructions, see To Start a Domain (or Server).


Example 4–3 Deleting a JVM Option

The following example command removes a single JVM option:


asadmin delete-jvm-options -Dopt1=A

Information similar to the following is displayed:


deleted 1 option(s)
Command delete-jvm-options executed successfully.


Example 4–4 Deleting Multiple JVM Options

The following example command removes multiple JVM options:


asadmin delete-jvm-options -Doption1=-value1:-Dvariable=\$HOME

Information similar to the following is displayed:


deleted 2 option(s)
Command delete-jvm-options executed successfully.

See Also

To see the full syntax and options of the command, type asadmin delete-jvm-options --help at the command line.

ProcedureTo Generate a JVM Report

The remote generate-jvm-report command enables you to generate a JVM report showing the threads (dump of a stack trace), classes, memory, and loggers for a specified domain administration server (DAS). You can generate the following types of reports: summary (default), class, thread, log.

  1. Ensure that the server is running.

    Remote commands require a running server.

  2. Generate the report by using the generate-jvm-report(1) command.


Example 4–5 Generating a JVM Report

The following example command displays summary information about the threads, classes, and memory:


generate-jvm-report --type summary 

Information similar to the following is displayed (partial output):


Operating System Information:
Name of the Operating System: Windows XP
Binary Architecture name of the Operating System: x86, Version: 5.1
Number of processors available on the Operating System: 2
System load on the available processors for the last minute: NOT_AVAILABLE. 
(Sum of running and queued runnable entities per minute).
.
,
.
user.home = C:\Documents and Settings\Jennifer
user.language = en
user.name = Jennifer
user.timezone = America/New_York
user.variant =
variable = \$HOME
web.home = C:\prelude\v3_prelude_release\distributions\web\target\glassfish\modu
les\web
Command generate-jvm-report executed successfully.

See Also

To see the full syntax and options of the command, type asadmin generate-jvm-report --help at the command line or see generate-jvm-report(1) in the reference manual.

Administering Profilers

Profilers generate information used to analyze server performance. If JVM options are created for a profiler, the options are used to record the settings needed to activate a particular profiler. You can use the create-jvm-options command to create JVM options in the Java configuration or profiler elements of the domain.xml file.

A server instance is associated with a particular profile by the profiler element in the Java configuration.

The following instructions are used to administer profiles:

ProcedureTo Create a Profiler

The remote create-profiler command enables you to create a profiler element in the Java configuration.

  1. Ensure that the server is running.

    Remote commands require a running server.

  2. Create a profiler by using the create-profiler(1) command.

  3. To apply your changes, restart Enterprise Server.

    1. Stop Enterprise Server.

      For instructions, see To Stop a Domain (or Server).

    2. Start Enterprise Server.

      For instructions, see To Start a Domain (or Server).


Example 4–6 Creating a Profiler

The following example command creates a profiler named sample_profiler:


asadmin create-profiler --classpath=/home/appserver/ --nativelibrarypath=/u/home/lib --enabled=false 
--property=defaultuser=admin:password=adminadmin sample_profiler

Information similar to the following is displayed:


Command create-profiler executed successfully.

See Also

To see the full syntax and options of the command, type asadmin create-profiler --help at the command line.

ProcedureTo Delete a Profiler

The remote delete-profiler command enables you to delete a profiler element from the Java configuration.

  1. Ensure that the server is running.

    Remote commands require a running server.

  2. If necessary, notify users that the profiler is being deleted.

  3. Delete the profiler by using the delete-profiler(1) command.

  4. To apply your changes, restart Enterprise Server.

    1. Stop Enterprise Server.

      For instructions, see To Stop a Domain (or Server).

    2. Start Enterprise Server.

      For instructions, see To Start a Domain (or Server).


Example 4–7 Deleting a Profiler

The following example command deletes the profiler named sample_profiler:


delete-profiler sample_profiler

Information similar to the following is displayed:


Command delete-profiler executed successfully.

See Also

To see the full syntax and options of the command, type asadmin delete-profiler --help at the command line.