This chapter provides instructions for performing general administration tasks in the Oracle GlassFish Server 3.0.1 environment by using the asadmin command-line utility.
The following topics are addressed here:
Instructions for accomplishing the tasks in this chapter by using the Administration Console are contained in the Administration Console online help.
Use the asadmin utility to perform administrative tasks for Oracle GlassFish Server from the command line or from a script. You can use this utility instead of the Administration Console interface.
The following topics are addressed here:
The asadmin utility is located in the as-install/bin directory. To run the asadmin utility without specifying the path, ensure that this directory is in your path.
The syntax for running the asadmin utility is as follows:
asadmin [asadmin-util-options] [subcommand [subcommand-options] [operands]] |
The replaceable items in this syntax are described in the subsections that follow. For full details of this syntax, see the asadmin(1M) help page.
The subcommand identifies the operation or task that you are performing. Subcommands are case-sensitive. Each subcommand is either a local subcommand or a remote subcommand.
A local subcommand can be run without a running domain administration server (DAS). However, to run the subcommand and have access to the installation directory and the domain directory, the user must be logged in to the machine that hosts the domain.
A remote subcommand is always run by connecting to a DAS and running the subcommand there. A running DAS is required.
For a list of the subcommands for this release of GlassFish Server, see Section 1 of Oracle GlassFish Server 3.0.1 Reference Manual.
Options control the behavior of the asadmin utility and its subcommands. Options are case-sensitive.
The asadmin utility has the following types of options:
asadmin utility options. These options control the behavior of the asadmin utility, not the subcommand. The asadmin utility options may precede or follow the subcommand, but asadmin utility options after the subcommand are deprecated. All asadmin utility options must either precede or follow the subcommand. If asadmin utility options are specified both before and after the subcommand, an error occurs. For a description of the asadmin utility options, see the asadmin(1M) help page.
Subcommand Options. These options control the behavior of the subcommand, not the asadmin utility. Subcommand options must follow the subcommand. For a description of a subcommand’s options, see the entry for the subcommand in Oracle GlassFish Server 3.0.1 Reference Manual.
Not all subcommand options are supported for this release of GlassFish Server. If you specify an unsupported option, a syntax error does not occur. Instead, the command runs successfully and the unsupported option is silently ignored.
A subcommand option may have the same name as an asadmin utility option, but the effects of the two options are different.
Options have a long form and a short form.
The short form of an option has a single dash (-) followed by a single character.
The long form of an option has two dashes (--) followed by an option word.
For example, the short form and the long form of the option for specifying terse output are as follows:
Short form: -t
Long form: --terse
Most options require argument values, except Boolean options, which toggle to enable or disable a feature.
Operands specify the items on which the subcommand is to act. Operands must follow the argument values of subcommand options, and are set off by a space, a tab, or double dashes (--). The asadmin utility treats anything that follows the subcommand options and their values as an operand.
In single mode, you must type a separate asadmin command for each subcommand that you want to use. After the subcommand has run, you are returned to the operating system's command shell. Any asadmin utility options must be specified in each separate asadmin command that you run. If you require the same asadmin utility options for multiple subcommands, use the asadmin utility in multimode. For more information, see To Start a Multimode Session.
In the operating system's command shell, run the asadmin utility, specifying the subcommand.
If necessary, also specify any required asadmin utility options, subcommand options, and operands.
This example runs the list-applications(1) subcommand in single mode. In this example, the default values for all options are used.
The example shows that the application hello is deployed on the local host.
asadmin list-applications hello <web> Command list-applications executed successfully. |
This example specifies the --host asadmin utility option with the list-applications subcommand in single mode. In this example, the DAS is running on the host srvr1.example.com.
The example shows that the applications basic-ezcomp, scrumtoys, ejb31-war, and automatic-timer-ejb are deployed on the host srvr1.example.com.
asadmin --host srvr1.example.com list-applications basic-ezcomp <web> scrumtoys <web> ejb31-war <ejb, web> automatic-timer-ejb <ejb> Command list-applications executed successfully. |
This example specifies the --host asadmin utility option and the --type subcommand option with the list-applications subcommand in single mode. In this example, the DAS is running on the host srvr1.example.com and applications of type web are to be listed.
asadmin --host srvr1.example.com list-applications --type web basic-ezcomp <web> scrumtoys <web> ejb31-war <ejb, web> Command list-applications executed successfully. |
GlassFish Server provides help information about the syntax, purpose, and options of the asadmin utility and its subcommands. This help information is written in the style of UNIX platform man pages. This help information is also available in Oracle GlassFish Server 3.0.1 Reference Manual.
If you are displaying help information for a remote subcommand, ensure that the server is running.
Remote subcommands require a running server.
Specify the subcommand of interest as the operand of the help subcommand.
If you run the help subcommand without an operand, help information for the asadmin utility is displayed.
This example displays the help information for the asadmin utility.
asadmin help |
This example displays the help information for the create-jdbc-resource subcommand.
asadmin help create-jdbc-resource |
To display the available subcommands, use the list-commands(1) subcommand. Local subcommands are displayed before remote subcommands. If the server is not running, only local subcommands are displayed.
The asadmin utility can be used in multiple command mode, or multimode. In multimode, you run the asadmin utility once to start a multimode session. During the session, the asadmin utility continues to accept subcommands until you end the session and return to the operating system's command shell. Any asadmin utility options that you set for your multimode session are used for all subsequent subcommands in the session.
Starting a multimode session does not require a running DAS.
Do one of the following:
Run the asadmin utility without a subcommand.
Use the multimode(1) subcommand.
If necessary, also specify any asadmin utility options that will apply throughout the multimode session.
In a multimode session, the asadmin> prompt is displayed on the command line. You can now type asadmin subcommands at this prompt to administer GlassFish Server.
This example starts a multimode session in which the asadmin utility options --user and --passwordfile are set for the session.
asadmin --user admin1 --passwordfile pwd.txt multimode |
This example uses the multimode subcommand to start a multimode session in which the default asadmin utility options are used.
asadmin multimode |
The asadmin> prompt is displayed on the command line.
This example starts a multimode session and runs the list-domains subcommand in the session.
asadmin Enter commands one per "line", ^D to quit asadmin> list-domains Name: domain1 Status: Running Command list-domains executed successfully. asadmin> |
You can start a multimode session from within an existing session by running the multimode subcommand from within the existing session. After you end the second multimode session, you return to your original multimode session.
You can also view the full syntax and options of the subcommand by typing asadmin help multimode at the command line.
At the asadmin> prompt, type one of the following commands or key combinations:
exit
quit
UNIX and Linux systems: Ctrl-D
Windows systems: Ctrl-Z
You are returned to the operating system's command shell and the asadmin> prompt is no longer displayed. If the asadmin> prompt is still displayed, you might have opened a multimode session within a multimode session. In this situation, repeat this procedure to end the remaining multimode session.
Running a set of asadmin subcommands from a file enables you to automate repetitive tasks.
Create a plain text file that contains the sequence of subcommands that you want to run.
Run the multimode(1) subcommand, specifying the file that you created.
If necessary, also specify any asadmin utility options that are required to enable subcommands in the file to run.
This example contains the following:
A listing of a file that is named commands_file.txt, which contains a sequence of asadmin subcommands
The command to run the subcommands in the file commands_file.txt
The commands_file.txt file contains the asadmin utility subcommands to perform the following sequence of operations:
Creating the domain customdomain
Starting the domain customdomain
Listing all available subcommands
Stopping the domain customdomain
Deleting the domain customdomain
The content of the commands_file.txt file is as follows:
create-domain --portbase 9000 customdomain start-domain customdomain list-commands stop-domain customdomain delete-domain customdomain
This example runs the sequence of subcommands in the commands_file.txt file. Because the --portbase option is specified for the create-domain subcommand in the file, the --port asadmin utility option must also be set.
asadmin --port 9048 multimode --file commands_file.txt |
For more information about the subcommands in the preceding example, see the following help pages:
Shared server instances will often need to override attributes defined in their referenced configuration. Any configuration attribute can be overridden through a system property of the corresponding name.
The following topics are addressed here:
Use the create-system-properties subcommand in remote mode to create or update one or more system properties of the domain or configuration. Any configuration attribute can be overwritten through a system property of the corresponding name.
Ensure that the server is running.
Remote subcommands require a running server.
Create system properties by using the create-system-properties(1) subcommand.
Information about properties for the subcommand is included in this help page.
This example creates a system property associated with http-listener-port=1088 on localhost.
asadmin> create-system-properties http-listener-port=1088 Command create-system-properties executed successfully. |
You can also view the full syntax and options of the subcommand by typing asadmin help create-system-properties at the command line.
Use the list-system-properties subcommand in remote mode to list the system properties that apply to a domain or configuration.
Ensure that the server is running.
Remote subcommands require a running server.
List system properties by using the list-system-properties(1) subcommand.
The existing system properties are displayed, including predefined properties such as HTTP_LISTENER_PORT and HTTP_SSL_LISTENER_PORT.
This example lists the system properties on host localhost.
asadmin> list-system-properties http-listener-port=1088 Command list-system-properties executed successfully. |
You can also view the full syntax and options of the subcommand by typing asadmin help list-system-properties at the command line.
Use the delete-system-property subcommand in remote mode to delete system properties.
Ensure that the server is running.
Remote subcommands require a running server.
List the existing system properties by using the list-system-properties(1) subcommand.
Delete the system property by using the delete-system-property(1) subcommand.
If necessary, notify users that the system property has been deleted.
This example deletes a system property named http-listener-port from localhost.
asadmin> delete-system-property http-listener-port Command delete-system-property executed successfully. |
You can also view the full syntax and options of the subcommand by typing asadmin help delete-system-property at the command line.
This section contains instructions for integrating resources into the GlassFish Server environment. Information about administering specific resources, such as JDBC, is contained in other chapters.
Use the add-resources subcommand in remote mode to create the resources named in the specified XML file. The following resources are supported: JDBC connection pool and resource, JMS, JNDI, and JavaMail resources, custom resource, connector resource and work security map, admin object, and resource adapter configuration.
The XML file must reside in the as-install/domains/domain1/config directory. If you specify a relative path or simply provide the name of the XML file, this subcommand will prepend as-install/domains/domain1/config to this operand.
Ensure that the server is running.
Remote subcommands require a running server.
Add resources from an XML file by using the add-resources(1) subcommand.
Information about properties for the subcommand is included in this help page.
Restart GlassFish Server.
See To Restart a Domain.
This example creates resources using the contents of the resource.xml file on localhost.
asadmin> add-resources c:\tmp\resource.xml Command : JDBC resource jdbc1 created successfully. Command : JDBC connection pool poolA created successfully. Command add-resources executed successfully. |
You can also view the full syntax and options of the subcommand by typing asadmin help add-resources at the command line.
The following topics are addressed here:
Use the version subcommand in remote mode to display information about the GlassFish Server version for a particular server. If the subcommand cannot communicate with the server by using the specified login (user/password) and target (host/port) information, then the local version is displayed along with a warning message.
Ensure that the server is running.
Remote subcommands require a running server.
Display the version by using the version(1) subcommand.
This example displays the version of GlassFish Server on the local host.
asadmin> version Version = Oracle GlassFish Server 3.0.1 (build 19) Command version executed successfully. |
You can also view the full syntax and options of the subcommand by typing asadmin help version at the command line.
Use the list-applications subcommand in remote mode to list the deployed Java applications. If the --type option is not specified, all applications are listed.
Ensure that the server is running.
Remote subcommands require a running server.
List applications by using the list-applications(1) subcommand.
This example lists the web applications on localhost.
asadmin> list-applications --type web hellojsp <web> Command list-applications executed successfully. |
You can also view the full syntax and options of the subcommand by typing asadmin help list-applications at the command line.
Use the list-containers subcommand in remote mode to list application containers.
Ensure that the server is running.
Remote subcommands require a running server.
List containers by using the list-containers(1) subcommand.
This example lists the containers on localhost.
asadmin> list-containers List all known application containers Container : grizzly Container : ejb Container : webservices Container : ear Container : appclient Container : connector Container : jpa Container : web Container : jruby Container : security Container : webbeans Command list-containers executed successfully. |
You can also view the full syntax and options of the subcommand by typing asadmin help list-containers at the command line.
Use the list-modules subcommand in remote mode to list the modules that are accessible to the GlassFish Server module subsystem. The status of each module is included. Possible statuses include NEW and READY.
Ensure that the server is running.
Remote subcommands require a running server.
List modules by using the list-modules(1) subcommand.
This example lists the accessible modules.
asadmin> list-modules |
Information similar to the following is displayed (partial output):
List Of Modules Module : org.glassfish.web.jstl-connector:10.0.0.b28 properties=(visibility=public,State=READY,Sticky=true) Module Characteristics : List of Jars implementing the module Jar : file:/C:/Preview/v3_Preview_release/distributions/web/target/glass fish/modules/web/jstl-connector.jar Module Characteristics : List of imported modules Module Characteristics : Provides to following services Module : org.glassfish.admingui.console-common:10.0.0.b28 properties=(visibility=public,State=NEW,Sticky=true) Module : org.glassfish.admin.launcher:10.0.0.b28 properties=(visibility=public,State=NEW,Sticky=true) Module : org.glassfish.external.commons-codec-repackaged:10.0.0.b28 properties=(visibility=public,State=NEW,Sticky=true) Module : com.sun.enterprise.tiger-types-osgi:0.3.32.Preview-b28 properties=(visibility=public,State=READY,Sticky=true) Module Characteristics : List of imported modules Module Characteristics : Provides to following services Module Characteristics : List of Jars implementing the module Jar : file:/C:/Preview/v3_Preview_release/distributions/web/target/glass fish/modules/tiger-types-osgi.jar. ... Command list-modules executed successfully. |
You can also view the full syntax and options of the subcommand by typing asadmin help list-modules at the command line.
Use the list-commands subcommand in remote mode to list the deployed asadmin subcommands. You can specify that only remote subcommands or only local subcommands are listed. By default, this subcommand displays a list of local subcommands followed by a list of remote subcommands.
Ensure that the server is running.
Remote subcommands require a running server.
List subcommands by using the list-commands(1) subcommand.
This example lists only local subcommands.
asadmin> list-commands --localonly create-domain delete-domain list-commands list-domains login monitor start-database start-domain stop-domain stop-database version Command list-commands executed successfully. |
You can also view the full syntax and options of the subcommand by typing asadmin help list-commands at the command line.
The timer service is a persistent and transactional notification service that is provided by the enterprise bean container and is used to schedule notifications or events used by enterprise beans. All enterprise beans except stateful session beans can receive notifications from the timer service. Persistent timers set by the service are not destroyed when the server is shut down or restarted.
Use the list-timers subcommand in remote mode to list the persistent timers owned by a specific server instance. You can use this information to decide whether to do a timer migration, or to verify that a migration has been completed successfully.
Ensure that the server is running.
Remote subcommands require a running server.
List timers by using thelist-timers(1) subcommand.
This example lists the timers in a particular standalone server instance. There is one currently active timer set.
asadmin> list-timers server 1 The list-timers command was executed successfully. |
Use the show-component-status subcommand in remote mode to get the status (either enabled or disabled) of the specified deployed component.
Ensure that the server is running.
Remote subcommands require a running server.
Show component status by using the show-component-status(1) subcommand.
This example shows the status of the MEjbApp component.
asadmin> show-component-status MEjbApp Status of MEjbApp is enabled Command show-component-status executed successfully. |
GlassFish Server provides representational state transfer (REST) interfaces to enable you to access monitoring and configuration data for GlassFish Server, including data that is provided by newly installed add-on components.
You can access the GlassFish Server REST interfaces through client applications such as:
You can also use the GlassFish Server REST interfaces in REST client applications that are developed in languages such as:
JavaScript
Ruby
Perl
Java
JavaFX
The implementation of the GlassFish Server REST interfaces is based on project Jersey. Project Jersey is the reference implementation of Java Specification Request (JSR) 311: JAX-RS: The Java API for RESTful Web Services. Information about JSR 311 is also available from the JSR 311 project home page.
The following topics are addressed here:
Each node in the configuration and monitoring object trees is represented as a REST resource that is accessible through an HTTP uniform resource locator (URL). Access to REST resources for GlassFish Server monitoring and configuration data requires a running DAS.
The formats of the URLs to resources that represent nodes in the configuration and monitoring object trees are as follows:
Configuration: http://host:port/management/domain/path
Monitoring: http://host:port/monitoring/domain/path
The replaceable items in these URLs are as follows:
The host where the DAS is running.
The HTTP port or HTTPS port for administration.
The path to the node. The path is the dotted name of the node in which each dot (.) is replaced with a slash (/). For more information, see the following documentation:
If the URL to a REST resource for GlassFish Server monitoring or configuration data is opened in a web browser, the browser displays a web page that contains the following information about the resource:
A list of the attributes of the resource and their values. If the resource represents a node in the configuration tree, these attributes are presented in an HTML form that you can use to update the resource. Attributes of a resource for a node in the monitoring tree are read only.
A list of hypertext links to the children of the resource. This list of links enables you to traverse the tree that contains the resource and to discover the all resources in the tree.
The following figure shows the web page for the REST resource for managing a domain.
The GlassFish Server REST interfaces support methods for accessing nodes in the monitoring and configuration object trees.
The following table shows the REST methods for administering monitoring and configuration data and the tasks that you can perform with each method. These methods are HTTP 1.1 primitives. For the detailed specification of these primitives, see Hypertext Transfer Protocol -- HTTP/1.1.
Table 2–1 REST Resource Methods for Administering Monitoring and Configuration Data
Task |
REST Method |
---|---|
Determine the methods and method parameters that a node in the tree supports |
OPTIONS or GET |
Retrieve data for a node in the tree |
GET |
Add a node to the tree |
POST |
Update a node in the tree |
POST |
Delete a node from the tree |
DELETE |
The GET method can be used instead of the OPTIONS method to determine the methods and method parameters that a node in the tree supports. The GET method also provides additional information about the node. For details, see To Retrieve Data for a Node in the Tree.
The methods and method parameters that a node in the tree supports depend on the REST resource that represents the node:
REST resources for monitoring support only the GET method.
All REST resources for configuration support the GET method and the OPTIONS method. However, only some REST resources for configuration also support the POST method and the DELETE method.
Before performing any operations on a node in the tree, determine the methods and method parameters that the node supports.
You can specify the format in which this information is presented. For more information, see Formats for Resource Representation.
Ensure that the server is running.
Operations on REST resources for GlassFish Server data require a running server.
Use the appropriate method on the REST resource that represents the node.
If the node is in the monitoring object tree, use the GET method.
If the node is in the configuration object tree, use the OPTIONS method or the GET method.
The GET method and the OPTIONS method return the list of methods that the resource supports. For each method, the list of acceptable message parameters or the list of acceptable query parameters are returned.
This example uses the cURL utility to determine the methods and method parameters that the resource for the domain supports. The example uses the following options of the cURL utility:
-X to specify that the OPTIONS method is used
-H to specify that the resource is represented in JavaScript Object Notation (JSON)
In this example, the DAS is running on the local host and the HTTP port for administration is 4848. In addition to the OPTIONS method, the resource supports the POST method and the GET method.
curl -X OPTIONS -H "Accept: application/json" http://localhost:4848/management/domain {"Domain": { "Method":{ "Name":"POST", "Message Parameters":{ "log-root":{"Key":"false", "Type":"string", "Optional":"true"}, "application-root":{"Key":"false", "Type":"string", "Optional":"true"}, "locale":{"Key":"false", "Type":"string", "Optional":"true"}, "version":{"Key":"false", "Type":"string", "Optional":"true"} } }, "Method":{ "Name":"GET" } } } |
Retrieving data for a node in the tree obtains the following information about the REST resource that represents the node:
A list of the REST methods that the resource supports
A list of the attributes of the resource and their values
A list of URLs to the children of the resource
You can specify the format in which this information is presented. For more information, see Formats for Resource Representation.
Ensure that the server is running.
Operations on REST resources for GlassFish Server data require a running server.
Use the GET method on the REST resource that represents the node.
This example uses the cURL utility to retrieve data for the resource for a domain. The example uses the following options of the cURL utility:
-X to specify that the GET method is used
-H to specify that the resource is represented in JavaScript Object Notation (JSON)
In this example, the DAS is running on the local host and the HTTP port for administration is 4848.
Line breaks are added to enhance readability.
curl -X GET -H "Accept: application/json" http://localhost:4848/management/domain { "Domain":{"log-root":"${com.sun.aas.instanceRoot}/logs", "application-root":"${com.sun.aas.instanceRoot}/applications", "locale":"", "version":"74.1"}, "Methods":{ "Method":{ "Name":"POST", "Message Parameters":{ "log-root":{"Key":"false", "Type":"string", "Optional":"true"}, "application-root":{"Key":"false", "Type":"string", "Optional":"true"}, "locale":{"Key":"false", "Type":"string", "Optional":"true"}, "version":{"Key":"false", "Type":"string", "Optional":"true"} } }, "Method":{ "Name":"GET" } }, "Child Resources":[ "http://localhost:4848/management/domain/configs", "http://localhost:4848/management/domain/resources", "http://localhost:4848/management/domain/servers", "http://localhost:4848/management/domain/property", "http://localhost:4848/management/domain/applications", "http://localhost:4848/management/domain/system-applications", "http://localhost:4848/management/domain/stop", "http://localhost:4848/management/domain/restart", "http://localhost:4848/management/domain/uptime", "http://localhost:4848/management/domain/version", "http://localhost:4848/management/domain/rotate-log", "http://localhost:4848/management/domain/host-port" ] |
Ensure that the server is running.
Operations on REST resources for GlassFish Server data require a running server.
Determine the acceptable message parameters for the POST method of the resource that represents the parent of the node.
For information about how to perform this step, see To Determine the Methods and Method Parameters That a Node in the Tree Supports.
Use the POST method on the REST resource that represents the parent of the node that you are adding.
Confirm that the node has been added.
Perform this step on the resource that represents the node that you have just added, not the parent. For information about how to perform this step, see To Retrieve Data for a Node in the Tree.
This example uses the cURL utility to add a JDBC resource node to the tree by creating a REST resource to represent the JDBC resource.
In this example, the DAS is running on the local host and the HTTP port for administration is 4848.
Line breaks are added to enhance readability.
This step determines the acceptable message parameters for the POST method of the resource jdbc-resource.
curl -X OPTIONS -H "Accept: application/json" http://localhost:4848/management/domain/resources/jdbc-resource {"JdbcResource": { "Method":{ "Name":"POST", "Message Parameters":{ "id":{"Acceptable Values":"", "Default Value":"", "Type":"string", "Optional":"false"}, "enabled":{"Acceptable Values":"", "Default Value":"true", "Type":"boolean", "Optional":"true"}, "description":{"Acceptable Values":"", "Default Value":"", "Type":"string", "Optional":"true"}, "target":{"Acceptable Values":"", "Default Value":"", "Type":"string", "Optional":"true"}, "property":{"Acceptable Values":"", "Default Value":"", "Type":"string", "Optional":"true"}, "connectionpoolid":{"Acceptable Values":"", "Default Value":"", "Type":"string", "Optional":"false"} } }, "Method":{ "Name":"GET" } } } |
This step adds a resource as a child of the jdbc-resource resource. The -d option of the cURL utility sets the required message parameters as follows:
id is set to jdbc/myjdbcresource.
connectionpoolid is set to DerbyPool.
curl -X POST -d "id=jdbc/myjdbcresource&connectionpoolid=DerbyPool" http://localhost:4848/management/domain/resources/jdbc-resource "http://localhost:4848/management/domain/resources/jdbc-resource/ jdbc/myjdbcresource" created successfully. |
This step confirms that the node has been added by retrieving data for the REST resource that represents the node.
curl -X GET -H "Accept: application/json" http://localhost:4848/management/domain/resources/ jdbc-resource/jdbc-myjdbcresource { "JdbcMyjdbcresource":{"enabled":"true", "pool-name":"DerbyPool", "description":"", "jndi-name":"jdbc/myjdbcresource", "object-type":"user"}, "Methods":{ "Method":{ "Name":"POST", "Message Parameters":{ "enabled":{"Key":"false", "Default Value":"true", "Type":"boolean", "Optional":"true"}, "pool-name":{"Key":"false", "Type":"string", "Optional":"true"}, "description":{"Key":"false", "Type":"string", "Optional":"true"}, "jndi-name":{"Key":"true", "Type":"string", "Optional":"true"}, "object-type":{"Key":"false", "Default Value":"user", "Type":"string", "Optional":"true"} } }, "Method":{ "Name":"GET" }, "Method":{ "Name":"DELETE", "Message Parameters":{ "target":{"Acceptable Values":"", "Default Value":"", "Type":"string", "Optional":"true"} } } } } |
Ensure that the server is running.
Operations on REST resources for GlassFish Server data require a running server.
Determine the acceptable message parameters for the POST method of the resource that represents the node.
For information about how to perform this step, see To Determine the Methods and Method Parameters That a Node in the Tree Supports.
Use the POST method on the REST resource that represents the node that you are updating.
Confirm that the node has been updated.
For information about how to perform this step, see To Retrieve Data for a Node in the Tree.
This example uses the cURL utility to update a JDBC resource in the tree by modifying the REST resource that represents the JDBC resource.
In this example, the DAS is running on the local host and the HTTP port for administration is 4848.
Line breaks are added to enhance readability.
This step determines the acceptable message parameters for the POST method of the resource jdbc-myjdbcresource.
curl -X OPTIONS -H "Accept: application/json" http://localhost:4848/management/domain/resources/ jdbc-resource/jdbc-myjdbcresource {"JdbcMyjdbcresource": { "Method":{ "Name":"POST", "Message Parameters":{ "enabled":{"Key":"false", "Default Value":"true", "Type":"boolean", "Optional":"true"}, "pool-name":{"Key":"false", "Type":"string", "Optional":"true"}, "description":{"Key":"false", "Type":"string", "Optional":"true"}, "jndi-name":{"Key":"true", "Type":"string", "Optional":"true"}, "object-type":{"Key":"false", "Default Value":"user", "Type":"string", "Optional":"true"} } }, "Method":{ "Name":"GET" }, "Method":{ "Name":"DELETE", "Message Parameters":{ "target":{"Acceptable Values":"", "Default Value":"", "Type":"string", "Optional":"true"} } } } } |
This step updates the REST resource jdbc-myjdbcresource to disable the JDBC resource that jdbc-myjdbcresource represents. The -d option of the cURL utility sets the enabled message parameter to disabled.
curl -X POST -d "enabled=false" http://localhost:4848/management/domain/resources/ jdbc-resource/jdbc-myjdbcresource "http://localhost:4848/management/domain/resources/jdbc-resource/ jdbc-myjdbcresource" updated successfully. |
This step confirms that the node has been updated by retrieving data for the REST resource that represents the node.
curl -X GET -H "Accept: application/json" http://localhost:4848/management/domain/resources/ jdbc-resource/jdbc-myjdbcresource { "JdbcMyjdbcresource":{"enabled":"false", "pool-name":"DerbyPool", "description":"", "jndi-name":"jdbc/myjdbcresource", "object-type":"user"}, "Methods":{ "Method":{ "Name":"POST", "Message Parameters":{ "enabled":{"Key":"false", "Default Value":"true", "Type":"boolean", "Optional":"true"}, "pool-name":{"Key":"false", "Type":"string", "Optional":"true"}, "description":{"Key":"false", "Type":"string", "Optional":"true"}, "jndi-name":{"Key":"true", "Type":"string", "Optional":"true"}, "object-type":{"Key":"false", "Default Value":"user", "Type":"string", "Optional":"true"} } }, "Method":{ "Name":"GET" }, "Method":{ "Name":"DELETE", "Message Parameters":{ "target":{"Acceptable Values":"", "Default Value":"", "Type":"string", "Optional":"true"} } } } } |
Ensure that the server is running.
Operations on REST resources for GlassFish Server data require a running server.
Confirm that the node can be deleted.
For information about how to perform this step, see To Determine the Methods and Method Parameters That a Node in the Tree Supports.
Confirm that the node has been deleted.
Perform this step on the resource that represents the parent of the node that you have just deleted. For information about how to perform this step, see To Retrieve Data for a Node in the Tree.
This example uses the cURL utility to delete a JDBC resource from the tree by deleting the REST resource that represents the JDBC resource.
In this example, the DAS is running on the local host and the HTTP port for administration is 4848.
Line breaks are added to enhance readability.
This step confirms that the node can be deleted by retrieving the REST methods that the resource jdbc-myjdbcresource supports.
curl -X OPTIONS -H "Accept: application/json" http://localhost:4848/management/domain/resources/ jdbc-resource/jdbc-myjdbcresource {"JdbcMyjdbcresource": { "Method":{ "Name":"POST", "Message Parameters":{ "enabled":{"Key":"false", "Default Value":"true", "Type":"boolean", "Optional":"true"}, "pool-name":{"Key":"false", "Type":"string", "Optional":"true"}, "description":{"Key":"false", "Type":"string", "Optional":"true"}, "jndi-name":{"Key":"true", "Type":"string", "Optional":"true"}, "object-type":{"Key":"false", "Default Value":"user", "Type":"string", "Optional":"true"} } }, "Method":{ "Name":"GET" }, "Method":{ "Name":"DELETE", "Message Parameters":{ "target":{"Acceptable Values":"", "Default Value":"", "Type":"string", "Optional":"true"} } } } } |
This step deletes the jdbc-myjdbcresource resource.
curl -X DELETE http://localhost:4848/management/domain/resources/ jdbc-resource/jdbc-myjdbcresource |
This step confirms that the node has been deleted by retrieving data for the REST resource that represents the parent of the node.
curl -X GET -H "Accept: application/json" http://localhost:4848/management/domain/resources/jdbc-resource/ { "JdbcResource":{}, "Methods":{ "Method":{ "Name":"POST", "Message Parameters":{ "id":{"Acceptable Values":"", "Default Value":"", "Type":"string", "Optional":"false"}, "enabled":{"Acceptable Values":"", "Default Value":"true", "Type":"boolean", "Optional":"true"}, "description":{"Acceptable Values":"", "Default Value":"", "Type":"string", "Optional":"true"}, "target":{"Acceptable Values":"", "Default Value":"", "Type":"string", "Optional":"true"}, "property":{"Acceptable Values":"", "Default Value":"", "Type":"string", "Optional":"true"}, "connectionpoolid":{"Acceptable Values":"", "Default Value":"", "Type":"string", "Optional":"false"} } }, "Method":{ "Name":"GET" } }, "Child Resources":[ "http://localhost:4848/management/domain/resources/jdbc-resource/ jdbc-__TimerPool", "http://localhost:4848/management/domain/resources/jdbc-resource/ jdbc-__default" ] |
The GlassFish Server REST interfaces also support operations other than create, read, update, and delete (CRUD) operations, for example:
State management
Queries
Application deployment
These operations are supported through child resources of the resource on which the operation is performed. The child resources do not represent nodes in the configuration object tree.
For example, the resource for managing a domain provides child resources for non-CRUD operations as shown in the following table.
Table 2–2 Child Resources for Non-CRUD Operations on a Domain
Resource |
Action |
---|---|
host-port |
Displays the host on which the DAS is running and the port on which the DAS listens for HTTP requests. |
restart |
Stops and then restarts the DAS of the domain. |
rotate-log |
Rotates the server log file by renaming the file with a timestamp name in the format server.log_date-and-time, and creating an empty log file. |
stop |
Stops the DAS of the domain. |
uptime |
Displays the length of time that the DAS has been running since it was last restarted. |
version |
Displays version information for GlassFish Server. |
The GlassFish Server REST interfaces support basic authentication over a secure connection. When security is enabled, you must specify https as the protocol in the URLs to REST resources and provide a username and password.
Securing GlassFish Server REST Interfaces involves the following sequence of tasks:
Adding an admin-realm user to the asadmin user group
Enabling Secure Sockets Layer (SSL)
For information about how to perform these tasks from the command line, see the following documentation:
For information about how to perform these tasks by using the Administration Console, see the following topics in the Administration Console online help:
To Add a User to the Admin Realm
To Edit SSL Settings for a Protocol
The GlassFish Server REST interfaces represent resources in the following formats:
XML
HTML
How to specify the resource representation depends on how you are accessing the GlassFish Server REST interfaces. For example, if you are using the cURL utility, specify the resource representation through the -H option as follows:
For JSON, specify -H "Accept: application/json".
For XML, specify -H "Accept: application/xml".
For HTML, omit the -H option.
The general format for the JSON representation of a resource is as follows:
{ "resource":{attributes}, "Methods": { method-list } "Child Resources":[urls] }
The replaceable items in this format are as follows:
The name of the resource.
Zero or more name-value pairs separated by a comma (,). Each name-value pair is specified as "name":value.
One or more metadata sets separated by a comma (,) that represent the methods that the resource supports. For the format of each metadata set, see JSON Representation of a Method in a Method List.
Zero or more URLs to child resources separated by a comma (,).
The JSON representation of a method in a method list is as follows:
Method":{ "Name":"method-name", "Message Parameters":{ message-parameter-list } "Query Parameters":{ queryparameter- list } }
The replaceable items in this format are as follows:
The name of the method, which is GET, POST, or DELETE.
Zero or more metadata sets separated by a comma (,) that represent the message parameters that are allowed for the method. For the format of each metadata set, see JSON Representation of a Message Parameter or a Query Parameter.
Zero or more metadata sets separated by a comma (,) that represent the query parameters that are allowed for the method. For the format of each metadata set, see JSON Representation of a Message Parameter or a Query Parameter.
The JSON representation of a message parameter or a query parameter is as follows:
"parameter-name":{attribute-list}
The replaceable items in this format are as follows:
The name of the parameter.
A comma-separated list of name-value pairs of attributes for the parameter. Each pair is in the following format:
"name":"value"
Possible attributes are as follows:
The default value of the parameter.
The set or range of acceptable values for the parameter.
The data type of the parameter, which is one of the following types:
boolean
int
string
Indicates whether the parameter is optional. If true, the parameter is optional. If false, the parameter is required.
Indicates whether the parameter is key. If true, the parameter is key. If false, the parameter is not key.
This example shows the JSON representation of the resource for managing a domain. In this example, the DAS is running on the local host and the HTTP port for administration is 4848. The URL to the resource in this example is http://localhost:4848/management/domain.
Line breaks are added to enhance readability.
{ "Domain":{"log-root":"${com.sun.aas.instanceRoot}/logs", "application-root":"${com.sun.aas.instanceRoot}/applications", "locale":"", "version":"73"}, "Methods":{ "Method":{ "Name":"POST", "Message Parameters":{ "log-root":{"Key":"false", "Type":"string", "Optional":"true"}, "application-root":{"Key":"false", "Type":"string", "Optional":"true"}, "locale":{"Key":"false", "Type":"string", "Optional":"true"}, "version":{"Key":"false", "Type":"string", "Optional":"true"} } }, "Method":{ "Name":"GET" } }, "Child Resources":[ "http://localhost:4848/management/domain/configs", "http://localhost:4848/management/domain/resources", "http://localhost:4848/management/domain/servers", "http://localhost:4848/management/domain/property", "http://localhost:4848/management/domain/applications", "http://localhost:4848/management/domain/system-applications", "http://localhost:4848/management/domain/stop", "http://localhost:4848/management/domain/restart", "http://localhost:4848/management/domain/uptime", "http://localhost:4848/management/domain/version", "http://localhost:4848/management/domain/rotate-log", "http://localhost:4848/management/domain/host-port" ] } |
The general format for the XML representation of a resource is as follows:
<resource attributes> <Methods> method-list </Methods> children </type>
The replaceable items in this format are as follows:
The name of the resource.
Zero or more name-value pairs separated by a space. Each name-value pair is specified as name="value".
One or more XML elements that represent the methods that the resource supports. For the format of each element, see XML Representation of a Resource Method.
Zero or more XML elements that specify the URLs of child resources. Each element is specified as <child-resource>url</child-resource>, where child-resource is the name of the child resource and url is the URL to the child resource.
The XML representation of a method in a method list is as follows:
<Method name="method-name"> <Message-Parameters> message-parameter-list </Message-Parameters> <Query-Parameters> query-parameter-list </Query-Parameters> </Method>
The replaceable items in this format are as follows:
The name of the method, which is GET, POST, or DELETE.
Zero or more XML elements separated by a line feed that represent the message parameters that are allowed for the method. For the format of each element, see XML Representation of a Message Parameter or a Query Parameter.
Zero or more XML elements separated by a line feed that represent the query parameters that are allowed for the method. For the format of each element, see XML Representation of a Message Parameter or a Query Parameter.
The XML representation of a message parameter or a query parameter is as follows:
<parameter-name attribute-list/>
The replaceable items in this format are as follows:
The name of the parameter.
A space-separated list of name-value pairs of attributes for the parameter. Each pair is in the following format:
name="value"
Possible attributes are as follows:
The default value of the parameter.
The set or range of acceptable values for the parameter.
The data type of the parameter, which is one of the following types:
boolean
int
string
Indicates whether the parameter is optional. If true, the parameter is optional. If false, the parameter is required.
Indicates whether the parameter is key. If true, the parameter is key. If false, the parameter is not key.
This example shows the XML representation of the resource for managing a domain. In this example, the DAS is running on the local host and the HTTP port for administration is 4848. The URL to the resource in this example is http://localhost:4848/management/domain.
Line breaks are added to enhance readability.
<Domain log-root="${com.sun.aas.instanceRoot}/logs" application-root="${com.sun.aas.instanceRoot}/applications" locale="" version="73"> <Methods> <Method name="POST"> <Message-Parameters> <log-root Key="false" Type="string" Optional="true"/> <application-root Key="false" Type="string" Optional="true"/> <locale Key="false" Type="string" Optional="true"/> <version Key="false" Type="string" Optional="true"/> </Message-Parameters> </Method> <Method name="GET"> </Method> </Methods> <Child-Resources> <Child-Resource>http://localhost:4848/management/domain/configs</Child-Resource> <Child-Resource>http://localhost:4848/management/domain/resources</Child-Resource> <Child-Resource>http://localhost:4848/management/domain/servers</Child-Resource> <Child-Resource>http://localhost:4848/management/domain/property</Child-Resource> <Child-Resource>http://localhost:4848/management/domain/applications</Child-Resource> <Child-Resource>http://localhost:4848/management/domain/system-applications</Child-Resource> <Child-Resource>http://localhost:4848/management/domain/stop</Child-Resource> <Child-Resource>http://localhost:4848/management/domain/restart</Child-Resource> <Child-Resource>http://localhost:4848/management/domain/uptime</Child-Resource> <Child-Resource>http://localhost:4848/management/domain/version</Child-Resource> <Child-Resource>http://localhost:4848/management/domain/rotate-log</Child-Resource> <Child-Resource>http://localhost:4848/management/domain/host-port</Child-Resource> </Child-Resources> </Domain> |
The format for the HTML representation of a resource is a web page that provides the following information about the resource:
A list of the attributes of the resource and their values.
A list of the methods and method parameters that the resource supports. Each method and its parameters are presented as a field of the appropriate type in an HTML form.
A list of hypertext links to the children of the resource.
For a sample web page, see Figure 2–1. In this example, the DAS is running on the local host and the HTTP port for administration is 4848. The URL to the resource in this example is http://localhost:4848/management/domain.
This chapter provides procedures for administering domains in the Oracle GlassFish Server 3.0.1 environment by using the asadmin command-line utility.
The following topics are addressed here:
Instructions for accomplishing the tasks in this chapter by using the Administration Console are contained in the Administration Console online help.
A domain is a group of instances that are administered together. The domain provides a preconfigured runtime for user applications. In addition to providing an administration boundary, a domain provides the basic security structure whereby separate administrators can administer specific groups of server instances. By grouping the server instances into separate domains, different organizations and administrators can share a single installation of GlassFish Server. A domain has its own configuration, log files, and application deployment areas that are independent of other domains. If the configuration is changed for a domain, the configurations for other domains are not affected.
The GlassFish Server installer creates a default administrative domain named domain1, as well as an associated domain administration server (DAS) named server. The DAS is a specially-designated instance that authenticates the administrator, accepts requests from administration tools, and communicates with server instances in the domain to carry out requests. The DAS is sometimes referred to as the default server because it is the only server instance created during GlassFish Server installation that can be used for deployment.
The default administration port is 4848, but a different port can be specified during installation. When a domain is created, you are prompted for the administration user name and password, but you can accept the default in which case user name is admin and there is no password. To reset the administration password, see To Change the Administration Password.
The graphical Administration Console communicates with a specific DAS to administer the domain associated with the DAS. Each Administration Console session enables you to configure and manage the specific domain. If you create multiple domains, you must start a separate Administration Console session to manage each domain.
The following topics are addressed here:
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.
Determine which profile will apply to the domain.
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
Create a domain by using the create-domain(1) subcommand.
Information about the options for this subcommand is included in this help page.
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.
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
You can also view the full syntax and options of the subcommand by typing asadmin help create-domain at the command line.
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.
List domains by using the list-domains(1) subcommand.
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. |
You can also view the full syntax and options of the subcommand by typing asadmin help list-domain at the command line.
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:
The server (domain) uses file realm for authentication of administrative users.
If this condition is not true, you will need to specify the user name and password.
The file realm has one and only one user (what the user name is does not matter).
If this condition is not true, you will also need to specify the user name.
That one user has no password.
If this condition is not true, you will need to specify the password.
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.
Determine the name of the domain that you are logging in to.
To list the existing domains:
asadmin list-domains |
Log in to the domain by using the login(1)command.
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. |
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. |
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.
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.
A domain must be stopped before it can be deleted.
List domains by using the list-domains(1) subcommand.
If necessary, notify domain users that the domain is being deleted.
Ensure that the domain you want to delete is stopped.
If needed, see To Stop a Domain.
Delete the domain by using the delete-domain(1) subcommand.
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. |
You can also view the full syntax and options of the subcommand by typing asadmin help delete-domain at the command line.
The following topics are addressed here:
When you start a domain or server, the domain administration server (DAS) is started. After startup, the DAS runs constantly, listening for and accepting requests.
If the domain directory is not specified, the domain in the default as-install/domains directory is started. If there are two or more domains, the domain_name operand must be specified. Each domain must be started separately.
For Microsoft Windows, you can use an alternate method to start a domain. From the Windows Start menu, select the command for your distribution of GlassFish Server:
If you are using the Full Platform, select Programs -> Oracle GlassFish Server -> Start Admin Server.
If you are using the Web Profile, select Programs -> Oracle GlassFish Server Web Profile -> Start Admin Server.
This subcommand is supported in local mode only.
Start a domain by using the start-domain(1) subcommand.
This example starts domain2 in the default domain directory.
asadmin> start-domain domain2 |
If there is only one domain, you can omit the domain name. If you do not include the password, you might be prompted to supply it.
Name of the domain started: [domain1] and its location: [C:\prelude\v3_prelude_release\distributions\web\target\glassfish domains\domain1]. Admin port for the domain: [4848]. |
You can also view the full syntax and options of the subcommand by typing asadmin help start-domain at the command line.
Stopping a domain or server shuts down its domain administration server (DAS). When stopping a domain, the DAS stops accepting new connections and then waits for all outstanding connections to complete. This shutdown process takes a few seconds. While the domain is stopped, the Administration Console and most of the asadmin subcommands cannot be used. This subcommand is particularly useful in stopping a runaway server. For more controlled situations, you can use the restart-domain(1) subcommand.
For Microsoft Windows, you can use an alternate method to stop a domain. From the Start menu, select the command for your distribution of GlassFish Server:
If you are using the Full Platform, select Programs -> Oracle GlassFish Server -> Stop Admin Server.
If you are using the Web Profile, select Programs -> Oracle GlassFish Server Web Profile -> Stop Admin Server.
If necessary, notify users that you are going to stop the domain.
Stop the domain by using the stop-domain(1) subcommand.
This example stops domain1 in the default directory, where domain1 is the only domain present in the directory.
asadmin> stop-domain Waiting for the domain to stop ........... Command stop-domain executed successfully. |
You can also view the full syntax and options of the subcommand by typing asadmin help stop-domain at the command line.
Use the restart-domain subcommand in remote mode to restart the Domain Administration Server (DAS) of the specified host. When restarting a domain, the DAS stops accepting new connections and then waits for all outstanding connections to complete. This shutdown process takes a few seconds. Until the domain has restarted, the Administration Console and most of the asadmin subcommands cannot be used.
This subcommand is particularly useful for environments where the server machine is secured and difficult to get to. With the right credentials, you can restart the server from a remote location as well as from the same machine.
If the server will not restart, use the stop-domain(1) subcommand followed by the start-domain(1) subcommand.
Ensure that the server is running.
Remote subcommands require a running server.
Restart the domain by using the restart-domain(1) subcommand.
This example restarts mydoimain4 in the default directory.
asadmin> restart-domain mydomain4 Waiting for the domain to restart ........... Command restart-domain executed successfully. |
This example invokes the restart-domain subcommand in a browser.
http://yourhost:4848/__asadmin/restart-domain |
You can also view the full syntax and options of the subcommand by typing asadmin help restart-domain at the command line.
This section provides instructions for configuring your system to automatically restart a domain .
The following topics are addressed here:
On Windows, you can use the asadmin create-service subcommand to create a Windows service that restarts a Domain Administration Server (DAS).
Create the service by using the create-service(1) subcommand.
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 Windows Services Wrapper, type:
C:\glassfishv3\glassfish\domains\domain1\bin\domain1Service.exe start |
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. |
On Oracle Solaris 10, you can use the asadmin create-service subcommand to create an Oracle Solaris Service Management Facility (SMF) service that restarts a DAS. 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 10, 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 goes down, SMF restarts it.
To run the asadmin create-service subcommand, you must have solaris.smf.* authorization. See the useradd and usermod man pages to find out how to set the authorizations. 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 10 administration commands such as svccfg, svcs, and auths must be available in the PATH.
If a particular GlassFish Server domain should not have default user privileges, modify the manifest of the service and reimport the service.
Create the service by using the create-service(1) subcommand.
After the service is created, enable the service by using the svacdm enable command.
For example:
svacdm enable /appserver/domains/domain1 |
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 |
As you administer your service, the following Oracle Solaris commands are useful: auths, smf_security, svcadm, svccfg, rbac, useradd, and usermod.
To set up automatic restart on Linux, you edit the /etc/inittab file. If you use /etc/rc.local, or your system’s equivalent, place a line in /etc/rc.local that calls the desired asadmin subcommand.
Add a line of text to the /etc/inittab file.
For example:
das:3:respawn:/opt/SUNWappserver/bin/asadmin start-domain --user admin --passwordfile /opt/SUNWappserver/password.txt domain1 |
The text must be on a single line. The first three letters are a unique designator for the process and can be altered.
By default, the Java Virtual Machine (JVM) 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.
Add the following line to the section of the as-install\domains\domain-name\config\domain.xml file that defines Java VM options:
<jvm-options>-Xrs</jvm-options>
If the GlassFish Server service is running, restart the service for your changes to take effect.
The following topics are addressed here:
Use the uptime subcommand in remote mode to display the length of time that the domain administration server (DAS) has been running since it was last started.
Ensure that the server is running.
Remote subcommands require a running server.
Display uptime by using the uptime(1) subcommand.
This example displays the length of time that the DAS has been running.
asadmin> uptime Uptime: 1 Weeks, 4 days, 0 hours, 17 minutes, 14 seconds, Total milliseconds: 951434595 Command uptime executed successfully. |
You can also view the full syntax and options of the subcommand by typing asadmin help uptime at the command line.
GlassFish Server 3.0.1 requires Version 6 Java SE platform as the underlying virtual machine for the Java platform (Java Virtual Machine or JVM machine).
Do not downgrade to an earlier Java version after a domain has been created with a newer JVM machine. If you must downgrade your JVM machine, downgrade it only for individual domains.
If you have not already done so, download the desired Java SDK (not the JRE) and install it on your system.
The Java SDK can be downloaded from the Java SE Downloads page.
Start the domain for which you are changing the JDK.
Use the following format:
as-install/bin/asadmin start-domain domain-name |
For a valid JVM installation, locations are checked in the following order:
If a legal JDK is not found, a fatal error occurs and the problem is reported back to you.
If necessary, change the JVM machine attributes for the domain.
In particular, you might need to change the JAVA_HOME environment variable. For example, to change the JAVA_HOME variable, type:
as-install/bin/asadmin set "server.java-config.java-home=path-to-java-home" |
This chapter provides procedures for administering the Virtual Machine for the Java platform (Java Virtual Machine) or JVM machine) in the Oracle GlassFish Server 3.0.1 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.
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. GlassFish 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 GlassFish Server configuration.
The following topics are addressed here:
Use the create-jvm-options subcommand in remote mode 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.
Ensure that the server is running.
Remote subcommands require a running server.
Create JVM options by using the create-jvm-options(1) subcommand.
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.
Information about properties for the subcommand is included in this help page.
To apply your changes, restart GlassFish Server. See To Restart a Domain.
This example sets multiple Java system properties.
asadmin> create-jvm-options -Dunixlocation=/root/example: -Dvariable=\$HOME: -Dwindowslocation=d\\:\\\sun\\\appserver: -Doption1=-value1 created 4 option(s) Command create-jvm-options executed successfully. |
You can also view the full syntax and options of the subcommand by typing asadmin help create-jvm-options at the command line.
Use the list-jvm-options subcommand in remote mode to list the existing JVM options.
Ensure that the server is running.
Remote subcommands require a running server.
List JVM options by using the list-jvm-options(1) subcommand.
This example lists all JVM options.
asadmin> list-jvm-options -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. |
You can also view the full syntax and options of the subcommand by typing asadmin help list-jvm-options at the command line.
Use the delete-jvm-options subcommand in remote mode to delete JVM options from the Java configuration or profiler elements of the domain.xml file.
Ensure that the server is running.
Remote subcommands require a running server.
List JVM options by using the list-jvm-options(1) subcommand.
If necessary, notify users that the JVM option is being deleted.
Delete JVM options by using the delete-jvm-options(1) subcommand.
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.
To apply your changes, restart GlassFish Server. See To Restart a Domain.
This example removes a single JVM option.
asadmin> delete-jvm-options -Dopt1=A deleted 1 option(s) Command delete-jvm-options executed successfully. |
This example removes multiple JVM options.
asadmin> delete-jvm-options -Doption1=-value1:-Dvariable=\$HOME deleted 2 option(s) Command delete-jvm-options executed successfully. |
You can also view the full syntax and options of the subcommand by typing asadmin help delete-jvm-options at the command line.
Use the generate-jvm-report subcommand in remote mode 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.
Ensure that the server is running.
Remote subcommands require a running server.
Generate the report by using the generate-jvm-report(1) subcommand.
This example displays summary information about the threads, classes, and memory.
asadmin> generate-jvm-report --type summary 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:\Preview\v3_Preview_release\distributions\web\target\ glassfish\modules\web Command generate-jvm-report executed successfully. |
You can also view the full syntax and options of the subcommand by typing asadmin help generate-jvm-report at the command line.
A profiler generates information used to analyze server performance.
The following topics are addressed here:
A server instance is tied to a particular profiler by the profiler element in the Java configuration. If JVM options are created for a profiler, the options are used to record the settings needed to activate a particular profiler. Use the create-profiler subcommand in remote mode to create the profiler element in the Java configuration.
Only one profiler can exist. If a profiler already exists, you receive an error message that directs you to delete the existing profiler before creating a new one.
Ensure that the server is running.
Remote subcommands require a running server.
Create a profiler by using the create-profiler(1) subcommand.
Information about properties for the subcommand is included in this help page.
To apply your changes, restart GlassFish Server.
See To Restart a Domain.
This example 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 Command create-profiler executed successfully. |
You can also view the full syntax and options of the subcommand by typing asadmin help create-profiler at the command line.
Use the delete-profiler subcommand in remote mode to delete the profiler element from the Java configuration. You can then create a new profiler.
Ensure that the server is running.
Remote subcommands require a running server.
Delete the profiler by using the delete-profiler(1) subcommand.
To apply your changes, restart GlassFish Server.
See To Restart a Domain.
This example deletes the profiler named sample_profiler.
asadmin> delete-profiler sample_profiler Command delete-profiler executed successfully. |
You can also view the full syntax and options of the subcommand by typing asadmin help delete-profiler at the command line.
This chapter provides procedures for administering thread pools in the Oracle GlassFish Server 3.0.1 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.
The Virtual Machine for the Java platform (Java Virtual Machine) or JVM machine) can support many threads of execution simultaneously. To help performance, GlassFish Server maintains one or more thread pools. It is possible to assign specific thread pools to connector modules, to network listeners, or to the Object Request Broker (ORB).
One thread pool can serve multiple connector modules and enterprise beans. Request threads handle user requests for application components. When GlassFish Server receives a request, it assigns the request to a free thread from the thread pool. The thread executes the client's requests and returns results. For example, if the request needs to use a system resource that is currently busy, the thread waits until that resource is free before allowing the request to use that resource.
You can specify the minimum and maximum number of threads that are reserved for requests from applications. The thread pool is dynamically adjusted between these two values.
The following topics are addressed here:
Use the create-threadpool subcommand in remote mode to create a thread pool.
The minimum thread pool size that is specified signals the server to allocate at least that many threads in reserve for application requests. That number is increased up to the maximum thread pool size that is specified. Increasing the number of threads available to a process allows the process to respond to more application requests simultaneously.
If one resource adapter or application occupies all the GlassFish Server threads, thread starvation might occur. You can avoid this by dividing the GlassFish Server threads into different thread pools.
Ensure that the server is running.
Remote subcommands require a running server.
Create a new thread pool by using the create-threadpool(1) subcommand.
Information about options for the subcommand is included in this help page.
To apply your changes, restart GlassFish Server.
See To Restart a Domain.
Restart is not necessary for thread pools used by the web container.
This example creates threadpool-l.
asadmin> create-threadpool --maxthreadpoolsize 100 --minthreadpoolsize 20 --idletimeout 2 --workqueues 100 threadpool-1 Command create-threadpool executed successfully |
You can also view the full syntax and options of the subcommand by typing asadmin help create-threadpool at the command line.
Use the list-threadpools subcommand in remote mode to list the existing thread pools.
Ensure that the server is running.
Remote subcommands require a running server.
List the existing thread pools by using the list-threadpools(1) subcommand.
This example lists the existing thread pools.
asadmin> list-threadpools threadpool-1 Command list-threadpools executed successfully |
You can also view the full syntax and options of the subcommand by typing asadmin help list-threadpools at the command line.
Use the set subcommand to update the values for a specified thread pool.
List the existing thread pools by using the list-threadpools(1) subcommand.
Modify the values for a thread pool by using the set(1) subcommand.
The thread pool is identified by its dotted name.
To apply your changes, restart GlassFish Server.
See To Restart a Domain.
Restart is not necessary for thread pools used by the web container.
This example sets the max-thread-pool-size from its previous value to 8.
asadmin> set server.thread-pools.thread-pool.http-thread-pool.max-thread-pool-size=8 Command set executed successfully |
You can also view the full syntax and options of the subcommand by typing asadmin help set at the command line.
Use the delete-threadpool subcommand in remote mode to delete an existing thread pool. Deleting a thread pool will fail if that pool is referenced by a network listener.
Ensure that the server is running.
Remote subcommands require a running server.
List the existing thread pools by using the list-threadpools(1) subcommand.
Delete the specified thread pool by using the delete-threadpool(1) subcommand.
To apply your changes, restart GlassFish Server.
See To Restart a Domain.
Restart is not necessary for thread pools used by the web container.
This example deletes threadpool-1.
asadmin> delete-threadpool threadpool-1 Command delete-threadpool executed successfully |
You can also view the full syntax and options of the subcommand by typing asadmin help delete-threadpool at the command line.
This chapter explains how to administer web applications in the Oracle GlassFish Server 3.0.1 environment.
The following topics are addressed here:
Instructions for accomplishing some of these tasks by using the Administration Console are contained in the Administration Console online help.
You can call a servlet deployed to GlassFish Server by using a URL in a browser or embedded as a link in an HTML or JSP file. The format of a servlet invocation URL is as follows:
http://server:port/context-root/servlet-mapping?name=value
The following table describes each URL section.
Table 6–1 URL Fields for Servlets Within an Application
In this example, localhost is the host name, MortPages is the context root, and calcMortgage is the servlet mapping.
http://localhost:8080/MortPages/calcMortgage?rate=8.0&per=360&bal=180000
To invoke a servlet from within a JSP file, you can use a relative path. For example:
<jsp:forward page="TestServlet"/><jsp:include page="TestServlet"/>
ServletContext.log messages are sent to the server log. By default, the System.out and System.err output of servlets are sent to the server log. During startup, server log messages are echoed to the System.err output. Also by default, there is no Windows-only console for the System.err output.
You can change these defaults using the Administration Console Write to System Log box. If this box is checked, System.out output is sent to the server log. If it is unchecked, System.out output is sent to the system default location only.
You can use the default-web.xml file to define features such as filters and security constraints that apply to all web applications.
For example, directory listings are disabled by default for added security. To enable directory listings in your domain's default-web.xml file, search for the definition of the servlet whose servlet-name is equal to default, and set the value of the init-param named listings to true. Then restart the server.
<init-param> <param-name>listings</param-name> <param-value>true</param-value> </init-param>
If listings is set to true, you can also determine how directory listings are sorted. Set the value of the init-param named sortedBy to NAME, SIZE, or LAST_MODIFIED. Then restart the server.
<init-param> <param-name>sortedBy</param-name> <param-value>LAST_MODIFIED</param-value> </init-param>
The mime-mapping elements in default-web.xml are global and inherited by all web applications. You can override these mappings or define your own using mime-mapping elements in your web application's web.xml file. For more information about mime-mapping elements, see the Servlet specification.
You can use the Administration Console to edit the default-web.xml file, or edit the file directly using the following steps.
Place the JAR file for the filter, security constraint, or other feature in the domain-dir/lib directory.
Edit the domain-dir/config/default-web.xml file to refer to the JAR file.
To apply your changes, restart GlassFish Server.
See To Restart a Domain.
You can specify that a request for an old URL be treated as a request for a new URL. This is called redirecting a URL.
To specify a redirected URL for a virtual server, use the redirect_n property, where n is a positive integer that allows specification of more than one. Each of these redirect_n properties is inherited by all web applications deployed on the virtual server.
The value of each redirect_n property has two components which can be specified in any order:
The first component, from, specifies the prefix of the requested URI to match.
The second component, url-prefix, specifies the new URL prefix to return to the client. The from prefix is replaced by this URL prefix.
This example redirects from dummy to etude:
<property name="redirect_1" value="from=/dummy url-prefix=http://etude"/>
The Apache Tomcat Connector mod_jk can be used to connect the web container with web servers such as Apache HTTP Server. By using mod_jk, which comes with GlassFish Server, you can front GlassFish Server with Apache HTTP Server.
You can also use mod_jk directly at the JSP/servlet engine for load balancing.
Supported versions of the software referred to in this section include Apache HTTP Server 2.2.11 (UNIX), mod_ssl 2.2.11, OpenSSL 0.9.8a, and mod_jk 1.2.27.
The following topics are addressed here:
To Enable SSL Between the mod_jk Load Balancer and the Browser
To Enable SSL Between the mod_jk Load Balancer and GlassFish Server
You can front GlassFish Server with Apache HTTP Server by enabling the mod_jk protocol for one of GlassFish Server's network listeners, as described in this procedure. A typical use for mod_jk would be to have Apache HTTP Server handle requests for static resources, while having requests for dynamic resources, such as servlets and JavaServer Pages (JSPs), forwarded to, and handled by the GlassFish Server back-end instance.
When you use the jk-enabled attribute of the network listener, you do not need to copy any additional JAR files into the /lib directory. You can also create JK connectors under different virtual servers by using the network listener attribute jk-enabled.
Install Apache HTTP Server and mod_jk.
For information on installing Apache HTTP Server, see http://httpd.apache.org/docs/2.0/install.html.
For information on installing mod_jk, see http://tomcat.apache.org/connectors-doc/webserver_howto/apache.html.
Configure the following files:
apache2/conf/httpd.conf, the main Apache configuration file
apache2/config/workers.properties or domain-dir/config/glassfish-jk.properties (to use non-default values of attributes described at http://tomcat.apache.org/tomcat-5.5-doc/config/ajp.html)
If you use both the workers.properties file and the glassfish-jk.properties file, the file referenced by httpd.conf first takes precedence.
Start Apache HTTP Server (httpd).
Start GlassFish Server with at least one web application deployed.
In order for the mod_jk–enabled network listener to start listening for requests, the web container must be started. Normally, this is achieved by deploying a web application.
Create an HTTP listener by using the create-http-listener(1)subcommand.
asadmin> create-http-listener --listenerport 8009 --listeneraddress 0.0.0.0 --defaultvs server listener-name |
where listener-name is the name of the new listener.
Enable mod_jk by using the set(1) subcommand.
Use the following format:
asadmin> set server-config.network-config.network-listeners. network-listener.listener-name.jk-enabled=true |
where listener-name is the ID of the network listener for which mod_jk is being enabled.
If you are using the glassfish-jk.properties file and not referencing it in the httpd.conf file, point to the properties file by using the create-jvm-options(1) subcommand.
Use the following format:
asadmin> create-jvm-options -Dcom.sun.enterprise.web.connector.enableJK.propertyFile= domain-dir/config/glassfish-jk.properties |
To apply your changes, restart GlassFish Server.
See To Restart a Domain.
This example shows an httpd.conf file that is set for mod_jk.
LoadModule jk_module /usr/lib/httpd/modules/mod_jk.so JkWorkersFile /etc/httpd/conf/worker.properties # Where to put jk logs JkLogFile /var/log/httpd/mod_jk.log # Set the jk log level [debug/error/info] JkLogLevel debug # Select the log format JkLogStampFormat "[%a %b %d %H:%M:%S %Y] " # JkOptions indicate to send SSL KEY SIZE, JkOptions +ForwardKeySize +ForwardURICompat -ForwardDirectories # JkRequestLogFormat set the request format JkRequestLogFormat "%w %V %T" # Send all jsp requests to GlassFish JkMount /*.jsp worker1 # Send all glassfish-test requests to GlassFish JkMount /glassfish-test/* worker1
This example shows a workers.properties or glassfish-jk.properties file that is set for mod_jk.
# Define 1 real worker using ajp13 worker.list=worker1 # Set properties for worker1 (ajp13) worker.worker1.type=ajp13 worker.worker1.host=localhost worker.worker1.port=8009
For more information on Apache, see http://httpd.apache.org/.
For more information on Apache Tomcat Connector, see http://tomcat.apache.org/connectors-doc/index.html.
Load balancing is the process of dividing the amount of work that a computer has to do between two or more computers so that more work gets done in the same amount of time. Load balancing can be configured with or without security.
In order to support stickiness, the Apache mod_jk load balancer relies on a jvmRoute system property that is included in any JSESSIONID received by the load balancer. This means that every GlassFish Server instance that is front-ended by the Apache load balancer must be configured with a unique jvmRoute system property.
On each of the instances, perform the steps in To Enable mod_jk.
If your instances run on the same machine, you must choose different JK ports. The ports must match worker.worker*.port in your workers.properties file. See the properties file in Example 6–5.
On each of the instances, create the jvmRoute system property of GlassFish Server by using the create-jvm-options(1) subcommand.
Use the following format:
asadmin> create-jvm-options "-DjvmRoute=/instance-worker-name"/ |
where instance-worker-name is the name of the worker that you defined to represent the instance in the workers.properties file.
To apply your changes, restart Apache HTTP Server and GlassFish Server.
This example shows an httpd.conf file that is set for load balancing.
LoadModule jk_module /usr/lib/httpd/modules/mod_jk.so JkWorkersFile /etc/httpd/conf/worker.properties # Where to put jk logs JkLogFile /var/log/httpd/mod_jk.log # Set the jk log level [debug/error/info] JkLogLevel debug # Select the log format JkLogStampFormat "[%a %b %d %H:%M:%S %Y] " # JkOptions indicate to send SSL KEY SIZE, JkOptions +ForwardKeySize +ForwardURICompat -ForwardDirectories # JkRequestLogFormat set the request format JkRequestLogFormat "%w %V %T" # Send all jsp requests to GlassFish JkMount /*.jsp worker1 # Send all glassfish-test requests to GlassFish JkMount /glassfish-test/* loadbalancer |
This example shows a workers.properties or glassfish-jk.properties file that is set for load balancing. The worker.worker*.port should match with JK ports you created.
worker.list=worker1,worker2,loadbalancer worker.worker1.type=ajp13 worker.worker1.host=localhost worker.worker1.port=8009 worker.worker1.lbfactor=1 worker.worker1.socket_keepalive=1 worker.worker1.socket_timeout=300 worker.worker2.type=ajp13 worker.worker2.host=localhost worker.worker2.port=8010 worker.worker2.lbfactor=1 worker.worker2.socket_keepalive=1 worker.worker2.socket_timeout=300 worker.loadbalancer.type=lb worker.loadbalancer.balance_workers=worker1,worker2 |
To activate security for mod_jk on GlassFish Server, you must first generate a Secure Socket Layer (SSL) self-signed certificate on the Apache HTTP Server with the mod_ssl module. The tasks include generating a private key, a Certificate Signing Request (CSR), a self-signed certificate, and configuring SSL-enabled virtual hosts.
The mod_jk connector must be enabled.
Generate the private key as follows:
openssl genrsa -des3 -rand file1:file2:file3:file4:file5 -out server.key 1024 |
where file1:file2: and so on represents the random compressed files.
Remove the pass-phrase from the key as follows:
openssl rsa -in server.key -out server.pem |
Generate the CSR is as follows:
openssl req -new -key server.pem -out server.csr |
Enter the information you are prompted for.
Generate a temporary certificate as follows:
openssl x509 -req -days 60 -in server.csr -signkey server.pem -out server.crt |
This temporary certificate is good for 60 days.
Create the ssl.conf file under the /etc/apache2/conf.d directory.
In the ssl.conf file, add one of the following redirects:
Redirect a web application, for example, JkMount /hello/* worker1.
Redirect all requests, for example, JkMount /* worker1.
# Send all jsp requests to GlassFish JkMount /*.jsp worker1 # Send all glassfish-test requests to GlassFish JkMount /glassfish-test/* loadbalancer |
A basic SSL-enabled virtual host will appear in the ssl.conf file. In this example, all requests are redirected.
Listen 443 <VirtualHost _default_:443> SSLEngine on SSLCipherSuite ALL:!ADH:!EXP56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP:+eNULL SSLCertificateFile "/etc/apache2/2.2/server.crt" SSLCertificateKeyFile "/etc/apache2/2.2/server.pem" JkMount /* worker1 </VirtualHost> |
The self-signed certificate must be configured.
Perform the steps in To Enable mod_jk.
Start another GlassFish Server with at least one web application deployed.
In order for the mod_jk–enabled network listener to start listening for requests, the web container must be started. Normally, this is achieved by deploying a web application.
Follow instructions from To Configure an HTTP Listener for SSL on the mod_jk connector.
Use the following format:
asadmin> create-ssl --type http-listener --certname sampleCert new-listener |
Add the following directives in the httpd.conf file under the /etc/apache2/conf.d directory:
# Should mod_jk send SSL information (default is On) JkExtractSSL On # What is the indicator for SSL (default is HTTPS) JkHTTPSIndicator HTTPS # What is the indicator for SSL session (default is SSL_SESSION_ID) JkSESSIONIndicator SSL_SESSION_ID # What is the indicator for client SSL cipher suit (default is SSL_CIPHER) JkCIPHERIndicator SSL_CIPHER # What is the indicator for the client SSL certificated? (default is SSL_CLIENT_CERT) JkCERTSIndicator SSL_CLIENT_CERT
To apply your changes, restart Apache HTTP Server and GlassFish Server.
This chapter provides instructions on how to configure logging and how to view log information in the Oracle GlassFish Server 3.0.1 environment.
The following topics are addressed here:
Instructions for accomplishing these tasks and also for editing properties by using the Administration Console are contained in the Administration Console online help.
Logging is the process by which GlassFish Server captures information about events that occur during server operation, such as configuration errors, security failures, or server malfunction. This data is recorded in a log file, and is usually the first source of information when problems occur. Analyzing the log files can help you to determine the health of the server.
Although application components can use the Apache Commons Logging Library to record messages, the platform standard JSR 047 API is recommended for better log configuration.
The following topics are addressed here:
GlassFish Server log records are captured in the server log. The server log is named server.log by default and is typically located in domain-dir/logs. You can change the default name or location of the server log by using the Administration Console.
In addition to the server log, the domain-dir/logs directory contains the following additional logs:
HTTP service access logs, located in the /access subdirectory
Transaction service logs, located in the /tx subdirectory
When the server log reaches the specified size in bytes, the log is rotated and renamed with a timestamp name to server.log_date, where date is the date and time that the file was rotated. You can also rotate this log manually by following instructions in Rotating the Server Log.
GlassFish Server log records follow a uniform format:
[#|yyyy-mm-ddThh:mm:ss.SSS-Z|Log Level|ProductName-Version|LoggerName|Key Value Pairs|Message|#] |
[# and #] mark the beginning and end of the record.
The vertical bar (|) separates the fields of the record.
yyyy-mm-ddThh:mm:ss.SSSS-Z specifies the date and time that the record was created. For example: 2006-10-21T13:25:53.852-0400
Log Level specifies the desired log level. You can select any of the following values: SEVERE, WARNING, INFO, CONFIG, FINE, FINER, and FINEST. The default is INFO.
ProductName-Version refers to the current version of the GlassFish Server. For example: glassfish
LoggerName is a hierarchical logger namespace that identifies the source of the log module. For example: javax.enterprise.system.core
Key Value Pairs refers to pairs of key names and values, typically a thread ID. For example: _ThreadID=14;
Message is the text of the log message. For all GlassFish Server SEVERE and WARNING messages and for many INFO messages, the message begins with a message ID that consists of a module code and a numerical value. For example: CORE5004
An example log record might look like this:
[#|2006-10-21T13:25:53.852-0400|INFO|GlassFish10.0|javax.enterprise. system.core|_ThreadID=13;|CORE5004: Resource Deployed: [cr:jms/DurableConnectionFactory].|#]
The Administration Console presents log records in a more readable display.
You can use the list-logger-levels(1) subcommand to list the existing loggers for the modules. Example loggers:
javax.enterprise.system.container.cmp: INFO javax.enterprise.system.tools.admin: INFO javax.enterprise.system.container.web: INFO javax.enterprise.system.util: INFO javax.enterprise.resource.webcontainer.jsf.timing: INFO javax: INFO javax.enterprise.resource.corba: INFO javax.enterprise.system.core.naming: INFO javax.enterprise.system.core.selfmanagement: INFO javax.enterprise.system.container.ejb: INFO javax.enterprise.resource.webcontainer.jsf.config: INFO javax.enterprise.resource.javamail: INFO org.apache.catalina: INFO javax.enterprise.system.core.config: INFO javax.enterprise.system.webservices.rpc: INFO javax.enterprise.system.webservices.registry: INFO javax.enterprise.system.tools.deployment: INFO javax.enterprise.resource.jms: INFO javax.enterprise.system: INFO javax.enterprise.system.webservices.saaj: INFO org.apache.jasper: INFO javax.enterprise.resource.webcontainer.jsf.lifecycle: INFO javax.enterprise.resource.jta: INFO javax.enterprise.resource.jdo: INFO javax.enterprise.resource.resourceadapter: INFO javax.enterprise.system.core.transaction: INFO javax.enterprise.resource.webcontainer.jsf.resource: INFO javax.enterprise.system.core.security: INFO javax.enterprise.resource.webcontainer.jsf.application: INFO javax.enterprise.system.core.classloading: INFO org.apache.coyote: INFO javax.enterprise.resource.webcontainer.jsf.managedbean: INFO javax.enterprise.system.container.ejb.mdb: INFO javax.enterprise.resource.webcontainer.jsf.context: INFO javax.enterprise.resource.webcontainer.jsf.renderkit: INFO javax.enterprise.resource.webcontainer.jsf.facelets: INFO javax.enterprise.resource.webcontainer.jsf.taglib: INFO |
The log level determines the granularity of the message that is logged, from error only (SEVERE) to detailed debug (FINEST). The following values apply: SEVERE, WARNING, INFO, CONFIG, FINE, FINER, and FINEST. These log levels are hierarchically inclusive, which means that if you set a particular log level, such as INFO, the messages that have log levels above that level (SEVERE and WARNING) are also included. If you set the log level to the lowest level, FINEST, your output will include all the messages in the file. The default setting is INFO.
There are two levels of log settings available: global and logger-specific. If you have chosen a logger-specific setting that is different from the global setting, the logger-specific setting takes precedence.
Setting the global log level is done by editing the logging.properties file. Logging levels for the individual modules are set by using the asadmin subcommands as explained in this section
Because setting log levels is a dynamic operation, you do not need to restart GlassFish Server for changes to take effect.
The following topics are addressed here:
Use the list-logger-levels subcommand in remote mode to list the modules and their current log levels.
Ensure that the server is running.
Remote subcommands require a running server.
List the existing module loggers by using the list-logger-levels(1) subcommand.
This example shows a partial list of the existing loggers and indicates how their log levels are set.
asadmin> list-logger-levels javax.enterprise.system.container.cmp: INFO javax.enterprise.system.tools.admin: INFO java.util.logging.ConsoleHandler: FINEST javax.enterprise.system.container.web: INFO javax.enterprise.system.util: INFO javax.enterprise.resource.webcontainer.jsf.timing: INFO javax: INFO javax.enterprise.resource.corba: INFO ... Command list-logger-levels executed successfully. |
You can also view the full syntax and options of the subcommand by typing asadmin help list-logger-levels at the command line.
The global log level specifies which kinds of events are logged across all loggers. The default level for message output to the console is INFO (which also includes SEVERE and WARNING messages).
You configure global logging by editing the logging.properties file. The default logging.properties file is located in the same directory as the domain.xml file, typically domain-dir/config. You can choose a different file name by using the java.util.logging.config.file system property to specify a file name. For example:
java -Djava.util.logging.config.file=myfile |
The ConsoleHandler has a separate log level setting that limits the messages that are displayed. For example:
java.util.logging.ConsoleHandler.level = INFO java.util.logging.ConsoleHandler.formatter = com.sun.enterprise.server.logging.UniformLogFormatter |
If you set the log level at the root level, you are setting the level of all loggers. This example sets the log level for all loggers to INFO:
.level= INFO
A module log level specifies which kinds of events are logged for a particular logger. The default level for message output to the console is INFO (which also includes SEVERE and WARNING messages). The global log level is overridden by a module-specific log level.
By default, the module log level is set to FINE. The lines for the loggers might look like this (the modules are indicated in bold):
#javax.enterprise.system.tools.level=FINE #javax.enterprise.system.container.ejb.level=FINE #javax.enterprise.system.core.security.level=FINE #javax.enterprise.system.tools.admin.level=FINE #javax.enterprise.level=FINE #javax.enterprise.system.container.web.level=FINE |
Because setting log levels is a dynamic operation, you do not need to restart GlassFish Server for changes to take effect.
Ensure that the server is running.
Remote subcommands require a running server.
List the existing module loggers by using the list-logger-levels(1) subcommand.
Set the log level for a module by using the set-log-level(1) subcommand.
Your choices are SEVERE, WARNING, INFO, CONFIG, FINE, FINER, and FINEST.
This example sets the log level for the web container logger to FINE.
asadmin> set-log-level javax.enterprise.system.container.web.level=FINE Command set-log-level executed successfully. |
This example sets the log level for security and web container loggers.
asadmin> set-log-level javax.enterprise.system.core.security.level=FINE javax.enterprise.system.container.web=WARNING Command set-log-level executed successfully. |
You can also view the full syntax and options of the subcommand by typing asadmin help set-log-level at the command line.
Logs are rotated automatically based on settings in the logging.properties file. You can change these settings by using the Administration Console.
You can rotate the server log file manually by using the rotate-log subcommand in remote mode. The server log in the default location is immediately moved to a time-stamped file and a new server log is created.
Because log rotation is a dynamic operation, you do not need to restart GlassFish Server for changes to take effect.
Ensure that the server is running.
Remote subcommands require a running server.
Rotate a log by using the rotate-log(1) subcommand.
This example moves the server.log file to yyyy-mm-dd_server.log and creates a new server.log file in the default location.
asadmin> rotate-log Command rotate-log executed successfuly. |
You can also view the full syntax and options of the subcommand by typing asadmin help rotate-log at the command line.
When GlassFish Server rotates a log file, it creates a new, empty file named server.log and renames the old file server.log_date, where date is the date and time when the file was rotated.
By default, GlassFish Server limits the number of rotated log files to 10. When this limit is reached, the oldest log file is deleted when GlassFish Server next rotates a log file.
If necessary, you can change the limit on the number of rotated log files. Any new limit that you set applies to rotated log files for both access logging and the server log.
You can change the limit on the number of rotated log files by using the create-system-properties subcommand in remote mode to set a system property.
Ensure that the server is running.
Remote subcommands require a running server.
Use the create-system-properties(1) subcommand to set the com.sun.enterprise.server.logging.max_history_files system property to the maximum number of rotated log files to keep.
The behavior of the com.sun.enterprise.server.logging.max_history_files system property is as follows:
If the property is not set, GlassFish Server keeps a maximum of 10 rotated log files.
If the property is set to an invalid number or null, GlassFish Server keeps a maximum of 10 rotated log files.
If the property is set to 0, GlassFish Server keeps no rotated log files.
This example changes the limit on the number of rotated log files to 5.
asadmin> create-system-properties com.sun.enterprise.server.logging.max_history_files=5 Command create-system-properties executed successfully. |
By default, all logging information is captured in the server.log file, typically located in domain-dir/logs. You can view logging information by using the Log Viewer in the Administration Console. Instructions for using the Administration Console logging functions are contained in the Administration Console online help.
To view information that has been collected for a module, you can open the server.log file in a text editor and search for the module that you are interested in.
This chapter explains how to monitor the Oracle GlassFish Server 3.0.1 components and services by using the asadmin command-line utility. Instructions for configuring JConsole to monitor GlassFish Server resources are also provided.
The following topics are addressed here:
Instructions for monitoring by using the Administration Console are contained in the Administration Console online help.
For information on using REST interfaces for monitoring, see Using REST Interfaces to Administer GlassFish Server.
Monitoring is the process of reviewing the statistics of a system to improve performance or solve problems. The monitoring service can track and display operational statistics, such as the number of requests per second, the average response time, and the throughput. By monitoring the state of various components and services deployed in GlassFish Server, you can identify performance bottlenecks, predict failures, perform root cause analysis, and ensure that everything is functioning as expected. Data gathered by monitoring can also be useful in performance tuning and capacity planning.
For this release of GlassFish Server, monitoring is exposed in a modular way so that many client modules can access and display the monitoring statistics. These clients include the Administration Console, the asadmin utility, AMX, and REST interfaces.
The following topics are addressed here:
A monitorable object is a component, subcomponent, or service that can be monitored. GlassFish Server uses a tree structure to track monitorable objects. Because the tree is dynamic, the tree changes as GlassFish Server components are added or removed.
In the tree, a monitorable object can have child objects (nodes) that represent exactly what can be monitored for that object. All child objects are addressed using the dot (.) character as a separator. These constructed names are referred to as dotted names. Detailed information on dotted names is available in the dotted-names(5ASC) help page.
The following command lists the monitorable child objects of the instance server:
asadmin> list --monitor "server.*" |
server.applications server.connector-service server.http-service server.jms-service server.containers.jruby server.jvm server.network server.orb server.resources server.security server.thread-pool server.transaction-service server.web |
Each object is represented by a dotted name. Dotted names can also address specific attributes in monitorable objects. For example, the jvm object has a memory attribute with a statistic called maxheapsize. The following dotted name addresses the attribute:
server.jvm.memory.maxheapsize
Although an object is monitorable, it is not necessarily being actively monitored. For instructions on activating monitoring, see Configuring Monitoring.
Each monitorable object has a hierarchical tree structure. In the tree, a replaceable such as *statistics represents the name of the attribute that you can show statistics for.
The following node tree hierarchies are addressed here:
The applications tree contains the following nodes:
server.applications |--- application1 | |--- ejb-module-1 | | |--- ejb1 * | | |--- bean-cache (for entity/sfsb) * | | |--- bean-pool (for slsb/mdb/entity) * | | |--- bean-methods | | |---method1 * | | |---method2 * | | |--- timers (for s1sb/entity/mdb) * | |--- web-module-1 | | |--- virtual-server-1 * | | |---servlet1 * | | |---servlet2 * |--- standalone-web-module-1 | | |----- virtual-server-2 * | | |---servlet3 * | | |---servlet4 * | | |----- virtual-server-3 * | | |---servlet3 *(same servlet on different vs) | | |---servlet5 * |--- standalone-ejb-module-1 | | |--- ejb2 * | | |--- bean-cache (for entity/sfsb) * | | |--- bean-pool (for slsb/mdb/entity) * | | |--- bean-methods | | |--- method1 * | | |--- method2 * | | |--- timers (for s1sb/entity/mdb) * |--- jersey-application-1 | |--- jersey | | |--- resources resource-0 hitcount *statistic |--- application2
An example dotted name might be server.applications.hello.server.request.maxtime.
An example dotted name under the EJB method node might be server.applications.ejbsfapp1.ejbsfapp1ejbmod1\.jar.SFApp1EJB1.
An example Jersey dotted name might be server.applications.helloworld-webapp.jersey.resources.resource-0.hitcount.resourcehitcount-count.
For available statistics, see EJB Statistics, Jersey Statistics, and Web Statistics.
The connector-service tree holds monitorable attributes for pools such as the connector connection pool. The connector-service tree contains the following nodes:
server.connector-service resource-adapter-1 connection-pools pool-1 work-management
An example dotted name might be server.connector-service.resource-adapter-1.connection-pools.pool-1. For available statistics, see JMS/Connector Service Statistics.
The http-service tree contains the following nodes:
server.http-service virtual-server request *statistic _asadmin request *statistic
An example dotted name under the virutal-server node might be server.http-service.virtual-server1.request.requestcount. For available statistics, see HTTP Service Statistics.
The jms-service tree holds monitorable attributes for connection factories (connection pools for resource adapters) and work management (for Message Queue resource adapters). The jms-service tree contains the following nodes:
server.jms-service connection-factories connection-factory-1 work-management
An example dotted name under the connection-factories node might be server.jms-service.connection-factories.connection-factory-1 which shows all the statistics for this connection factory. For available statistics, see JMS/Connector Service Statistics.
The jruby tree contains the following nodes:
server.containers.jruby.applications jruby-application *statistic http *statistic runtime-pool *statistic |
For available statistics, see JRuby Statistics.
The jvm tree contains the following nodes:
server.jvm class-loading-system compilation-system garbage-collectors memory operating-system runtime
An example dotted name under the memory node might be server.jvm.memory.maxheapsize. For available statistics, see JVM Statistics.
The network statistics apply to the network listener, such as admin-listener, http-listener-1, ttp-listener-2. The network tree contains the following nodes:
server.network type-of-listener keep-alive *statistic file-cache *statistic thread-pool *statistic connection-queue *statistic
An example dotted name under the network node might be server.network.admin-listener.keep-alive.maxrequests-count. For available statistics, see Network Statistics.
The orb tree holds monitorable attributes for connection managers. The orb tree contains the following nodes:
server.orb transport connectioncache inbound *statistic outbound *statistic
An example dotted name might be server.orb.transport.connectioncache.inbound.connectionsidle-count. For available statistics, see ORB Statistics (Connection Manager).
The resources tree holds monitorable attributes for pools such as the JDBC connection pool and connector connection pool. The resources tree contains the following nodes:
server.resources connection-pool request *statistic
An example dotted name might be server.resources.jdbc-connection-pool1.numconnfree.count. For available statistics, see Resource Statistics (Connection Pool).
The security tree contains the following nodes:
server.security ejb *statistic web *statistic realm *statistic
An example dotted name might be server.security.realm.realmcount-starttime. For available statistics, see Security Statistics.
The thread-pool tree holds monitorable attributes for connection managers, and contains the following nodes:
server.thread-pool orb threadpool thread-pool-1 *statistic
An example dotted name might be server.thread-pool.orb.threadpool.thread-pool-1.averagetimeinqueue-current. For available statistics, see Thread Pool Statistics.
The transaction-service tree holds monitorable attributes for the transaction subsystem for the purpose of rolling back transactions. The transaction-service tree contains the following nodes:
server.transaction-service statistic
An example dotted name might be server.tranaction-service.activeids. For available statistics, see Transaction Service Statistics.
The web tree contains the following nodes:
server.web jsp *statistic servlet *statistic session *statistic request *statistic
An example dotted name for the servlet node might be server.web.servlet.activeservletsloadedcount. For available statistics, see Web Module Common Statistics.
An add-on component typically generates statistics that GlassFish Server can gather at runtime. Adding monitoring capabilities enables an add-on component to provide statistics to GlassFish Server in the same way as components that are supplied in the GlassFish Server distributions. As a result, you can use the same administrative interfaces to monitor statistics from any installed GlassFish Server component, regardless of the origin of the component.
The following asadmin subcommands are provided for monitoring the services and components of GlassFish Server:
The enable-monitoring, disable-monitoring, or the get and set subcommands are used to turn monitoring on or off. For instructions, see Configuring Monitoring.
The monitor --type subcommand is used to display basic data for a particular type of monitorable object. For instructions, see Viewing Common Monitoring Data.
The list --monitor subcommand is used to display the objects that can be monitored with the monitor subcommand. For guidelines and instructions, see Guidelines for Using the list and get Subcommands for Monitoring.
The get subcommand is used to display comprehensive data, such as the attributes and values for a dotted name. The get subcommand used with a wildcard parameter displays all available attributes for any monitorable object. For additional information, see Guidelines for Using the list and get Subcommands for Monitoring.
By default, the monitoring service is enabled for GlassFish Server, but monitoring for the individual modules is not. To enable monitoring for a module, you change the monitoring level for that module to LOW or HIGH, You can choose to leave monitoring OFF for objects that do not need to be monitored.
LOW. Simple statistics, such as create count, byte count, and so on
HIGH. Simple statistics plus method statistics, such as method count, duration, and so on
OFF. No monitoring, no impact on performance
The following tasks are addressed here:
Use the enable-monitoring subcommand to enable the monitoring service itself, or to enable monitoring for individual modules. Monitoring is immediately activated, without restarting GlassFish Server.
You can also use the set(1) subcommand to enable monitoring for a module. Using the set command is not a dynamic procedure, so you need to restart GlassFish Server for your changes to take effect.
Determine which services and components are currently enabled for monitoring.
asadmin> get server.monitoring-service.module-monitoring-levels.* |
This example output shows that the HTTP service is not enabled (OFF for monitoring), but other objects are enabled:
configs.config.server-config.monitoring-service.module-monitoring-levels.web-container=HIGH configs.config.server-config.monitoring-service.module-monitoring-levels.http-service=OFF configs.config.server-config.monitoring-service.module-monitoring-levels.jvm=HIGH |
Enable monitoring by using the enable-monitoring(1) subcommand.
Server restart is not required.
This example enables the monitoring service without affecting monitoring for individual modules.
asadmin> enable-monitoring Command enable-monitoring executed successfully |
This example enables monitoring for the ejb-container module.
asadmin> enable-monitoring --level ejb-container=HIGH Command enable-monitoring executed successfully |
This example enables monitoring for the HTTP service by setting the monitoring level to HIGH (you must restart the server for changes to take effect).
asadmin> set server.monitoring-service.module-monitoring-levels.http-service=HIGH Command set executed successfully |
You can also view the full syntax and options of the subcommand by typing asadmin help enable-monitoring at the command line.
Use the disable-monitoring subcommand to disable the monitoring service itself, or to disable monitoring for individual modules. Monitoring is immediately stopped, without restarting GlassFish Server.
You can also use the set(1) subcommand to disable monitoring for a module. Using the set command is not a dynamic procedure, so you need to restart GlassFish Server for your changes to take effect.
Determine which services and components currently are enabled for monitoring.
asadmin get server.monitoring-service.module-monitoring-levels.* |
This example output shows that monitoring is enabled for web-container, http-service, and jvm:
configs.config.server-config.monitoring-service.module-monitoring-levels.web-container=HIGH configs.config.server-config.monitoring-service.module-monitoring-levels.http-service=HIGH configs.config.server-config.monitoring-service.module-monitoring-levels.jvm=HIGH |
Disable monitoring for a service or module by using the disable-monitoring(1) subcommand.
Server restart is not required.
This example disables the monitoring service without changing the monitoring levels for individual modules.
asadmin> disable-monitoring Command disable-monitoring executed successfully |
This example disables monitoring for specific modules. Their monitoring levels are set to OFF.
asadmin> disable-monitoring --modules web-container,ejb-container Command disable-monitoring executed successfully |
This example disables monitoring for the HTTP service (you must restart the server for changes to take effect).
asadmin> set server.monitoring-service.module-monitoring-levels.http-service=OFF Command set executed successfully |
You can also view the full syntax and options of the subcommand by typing asadmin help disable-monitoring at the command line.
Use the monitor subcommand to display basic data on commonly-monitored objects.
Use the --type option of the monitor subcommand to specify the object for which you want to display data, such as httplistener, jvm, webmodule. If you use the monitor subcommand without specifying a type, an error message is displayed.
Output from the subcommand is displayed continuously in a tabular format. The --interval option can be used to display output at a particular interval (the default is 30 seconds).
A monitorable object must be configured for monitoring before you can display data on the object. See To Enable Monitoring.
Determine which type of monitorable object you want to monitor.
Your choices for 3.0.1 are jvm, httplistener, and webmodule.
Request the monitoring data by using the monitor(1) subcommand.
This example requests common data for type jvm on instance server.
asadmin> monitor --type jvm server UpTime(ms) Heap and NonHeap Memory(bytes) current min max low high count 9437266 8585216 619642880 0 0 93093888 9467250 8585216 619642880 0 0 93093888 |
You can also view the full syntax and options of the subcommand by typing asadmin help monitor at the command line.
Common monitoring statistics are described in the following sections:
The statistics available for the httplistener type are shown in the following table.
Table 8–1 HTTP Listener Common Monitoring Statistics
Statistic |
Description |
---|---|
ec |
Error count. Cumulative value of the error count |
mt |
Maximum time. Longest response time for a request; not a cumulative value, but the largest response time from among the response times |
pt |
Processing time. Cumulative value of the times taken to process each request, with processing time being the average of request processing times over request |
rc |
Request count. Cumulative number of requests processed so far |
The statistics available for the jvm type are shown in the following table.
Table 8–2 JVM Common Monitoring Statistics
Statistic |
Description |
---|---|
count |
Amount of memory (in bytes) that is guaranteed to be available for use by the JVM machine |
high |
Retained for compatibility with other releases |
low |
Retained for compatibility with other releases |
max |
The maximum amount of memory that can be used for memory management. |
min |
Initial amount of memory (in bytes) that the JVM machine requests from the operating system for memory management during startup |
UpTime |
Number of milliseconds that the JVM machine has been running since it was last started |
The statistics available for the webmodule type are shown in the following table.
Table 8–3 Web Module Common Monitoring Statistics
Statistic |
Description |
---|---|
ajlc |
Number of active JavaServer Pages (JSP) technology pages that are loaded |
asc |
Current active sessions |
aslc |
Number of active servlets that are loaded |
ast |
Total active sessions |
mjlc |
Maximum number of JSP pages that are loaded |
mslc |
Maximum number of servlets that are loaded |
rst |
Total rejected sessions |
st |
Total sessions |
tjlc |
Total number of JSP pages that are loaded |
tslc |
Total number of servlets that are loaded |
By applying the list and get subcommands against the tree structure using dotted names, you can display more comprehensive monitoring data, such as a description of each of the statistics and its unit of measurement.
The following topics are addressed here:
The underlying assumptions for using the list and get subcommands with dotted names are:
A list subcommand that specifies a dotted name that is not followed by a wildcard (*) lists the current node’s immediate children. For example, the following subcommand lists all immediate children belonging to the server node:
list --monitor server
A list subcommand that specifies a dotted name followed by a wildcard of the form .* lists a hierarchical tree of child nodes from the specified node. For example, the following subcommand lists all children of the applications node, their subsequent child nodes, and so on:
list --monitor server.applications.*
A list subcommand that specifies a dotted name preceded or followed by a wildcard of the form *dottedname or dotted * name or dottedname * lists all nodes and their children that match the regular expression created by the specified matching pattern.
A get subcommand followed by a .* or a * gets the set of attributes and their values that belong to the node specified.
For example, the following table explains the output of the list and get subcommands used with the dotted name for the resources node.
Table 8–4 Example Resources Level Dotted Names
Subcommand |
Dotted Name |
Output |
---|---|---|
list --monitor |
server.resources |
List of pool names. |
list --monitor |
server.resources.connection-pool1 |
No attributes, but a message saying “Use get subcommand with the --monitor option to view this node’s attributes and values.” |
get --monitor |
server.resources.connection-pool1.* |
List of attributes and values corresponding to connection pool attributes. |
For detailed information on dotted names, see the dotted-names(5ASC) help page.
Although the monitor subcommand is useful in many situations, it does not offer the complete list of all monitorable objects. To work with comprehensive data for an object type, use the list --monitor and the get --monitor subcommands followed by the dotted name of a monitorable object.
A monitorable object must be configured for monitoring before you can display information about the object. See To Enable Monitoring if needed.
List the objects that are enabled for monitoring by using the list(1) subcommand.
For example, the following subcommand lists all components and services that have monitoring enabled for instance server.
asadmin> list --monitor "*" server.web server.connector-service server.orb server.jms-serviceserver.jvm server.applications server.http-service server.thread-pools |
Get data for a monitored component or service by using the get(1) subcommand.
This example gets information about all the attributes for object type jvm on instance server.
asadmin> get --monitor server.jvm.* server.jvm.class-loading-system.loadedclasscount = 3715 server.jvm.class-loading-system.totalloadedclasscount = 3731 server.jvm.class-loading-system.unloadedclasscount = 16 server.jvm.compilation-system.name-current = HotSpot Client Compiler server.jvm.compilation-system.totalcompilationtime = 769 server.jvm.garbage-collectors.Copy.collectioncount = 285 server.jvm.garbage-collectors.Copy.collectiontime = 980 server.jvm.garbage-collectors.MarkSweepCompact.collectioncount = 2 server.jvm.garbage-collectors.MarkSweepCompact.collectiontime = 383 server.jvm.memory.committedheapsize = 23498752 server.jvm.memory.committednonheapsize = 13598720 server.jvm.memory.initheapsize = 0 server.jvm.memory.initnonheapsize = 8585216 server.jvm.memory.maxheapsize = 66650112 server.jvm.memory.maxnonheapsize = 100663296 server.jvm.memory.objectpendingfinalizationcount = 0 server.jvm.memory.usedheapsize = 19741184 server.jvm.memory.usednonheapsize = 13398352 server.jvm.operating-system.arch-current = x86 server.jvm.operating-system.availableprocessors = 2 server.jvm.operating-system.name-current = Windows XP server.jvm.operating-system.version-current = 5.1 server.jvm.runtime.classpath-current = glassfish.jar server.jvm.runtime.inputarguments-current = [] server.jvm.runtime.managementspecversion-current = 1.0 server.jvm.runtime.name-current = 4372@ABBAGANI_WORK server.jvm.runtime.specname-current = Java Virtual Machine Specification server.jvm.runtime.specvendor-current = Sun Microsystems Inc. server.jvm.runtime.specversion-current = 1.0 server.jvm.runtime.uptime = 84813 server.jvm.runtime.vmname-current = Java HotSpot(TM) Client VM server.jvm.runtime.vmvendor-current = Sun Microsystems Inc. server.jvm.runtime.vmversion-current = 1.5.0_11-b03 |
This example lists all the monitorable applications for instance server.
asadmin> list --monitor server.applications.* server.applications.app1 server.applications.app2 server.applications.app1.virtual-server1 server.applications.app2.virtual-server1 |
This example gets information about all the attributes for application hello.
asadmin> get --monitor server.applications.hello.* server.applications.hello.server.activatedsessionstotal = 0 server.applications.hello.server.activejspsloadedcount = 1 server.applications.hello.server.activeservletsloadedcount = 1 server.applications.hello.server.activesessionscurrent = 1 server.applications.hello.server.activesessionshigh = 1 server.applications.hello.server.errorcount = 0 server.applications.hello.server.expiredsessionstotal = 0 server.applications.hello.server.maxjspsloadedcount = 1 server.applications.hello.server.maxservletsloadedcount = 0 server.applications.hello.server.maxtime = 0 server.applications.hello.server.passivatedsessionstotal = 0 server.applications.hello.server.persistedsessionstotal = 0 server.applications.hello.server.processingtime = 0.0 server.applications.hello.server.rejectedsessionstotal = 0 server.applications.hello.server.requestcount = 0 server.applications.hello.server.sessionstotal = server.applications.hello.server.totaljspsloadedcount = 0 server.applications.hello.server.totalservletsloadedcount = 0 |
This example gets information about the jvm attribute runtime.vmversion-current on instance server.
asadmin> get --monitor server.jvm.runtime.vmversion-current server.jvm.runtime.vmversion-current = 10.0-b23 |
You can get comprehensive monitoring statistics by forming a dotted name that specifies the statistic you are looking for. For example, the following dotted name will display the cumulative number of requests for the HTTP service on virtual-server1:
server.http-service.virtual-server1.request.requestcount
The tables in the following sections list the statistics that are available for each monitorable object:
EJBs fit into the tree of objects as shown in Applications Tree Hierarchy. Use the following dotted name pattern to get applications statistics:
server.applications.appname.ejbmodulename.ejbname.bean-cache.statistic
Statistics available for applications are shown in the following sections:
Use the following dotted name pattern for EJB cache statistics:
server.applications.appname.ejbmodulename.bean-cache.ejbname.statistic
The statistics available for EJB caches are listed in the following table.
Table 8–5 EJB Cache Monitoring Statistics
Statistic |
Data Type |
Description |
---|---|---|
cachemisses |
RangeStatistic |
The number of times a user request does not find a bean in the cache. |
cachehits |
RangeStatistic |
The number of times a user request found an entry in the cache. |
numbeansincache |
RangeStatistic |
The number of beans in the cache. This is the current size of the cache. |
numpassivations |
CountStatistic |
Number of passivated beans. Applies only to stateful session beans. |
numpassivationerrors |
CountStatistic |
Number of errors during passivation. Applies only to stateful session beans. |
numexpiredsessionsremoved |
CountStatistic |
Number of expired sessions removed by the cleanup thread. Applies only to stateful session beans. |
numpassivationsuccess |
CountStatistic |
Number of times passivation completed successfully. Applies only to stateful session beans. |
Use the following dotted name pattern for EJB container statistics:
server.applications.appname.ejbmodulename.container.ejbname
The statistics available for EJB containers are listed in the following table.
Table 8–6 EJB Container Monitoring Statistics
Statistic |
Data Type |
Description |
---|---|---|
createcount |
CountStatistic |
Number of times an EJB’s create method is called. |
messagecount |
CountStatistic |
Number of messages received for a message-driven bean. |
methodreadycount |
RangeStatistic |
Number of stateful or stateless session beans that are in the MethodReady state. |
passivecount |
RangeStatistic |
Number of stateful session beans that are in Passive state. |
pooledcount |
RangeStatistic |
Number of entity beans in pooled state. |
readycount |
RangeStatistic |
Number of entity beans in ready state. |
removecount |
CountStatistic |
Number of times an EJB’s remove method is called. |
Use the following dotted name pattern for EJB method statistics:
server.applications.appname.ejbmodulename.bean-methods.ejbname.statistic
The statistics available for EJB method invocations are listed in the following table.
Table 8–7 EJB Method Monitoring Statistics
Statistic |
Data Type |
Description |
---|---|---|
executiontime |
CountStatistic |
Time, in milliseconds, spent executing the method for the last successful/unsuccessful attempt to run the operation. This is collected for stateless and stateful session beans and entity beans if monitoring is enabled on the EJB container. |
methodstatistic |
TimeStatistic |
Number of times an operation is called; the total time that is spent during the invocation, and so on. |
totalnumerrors |
CountStatistic |
Number of times the method execution resulted in an exception. This is collected for stateless and stateful session beans and entity beans if monitoring is enabled for the EJB container. |
totalnumsuccess |
CountStatistic |
Number of times the method successfully executed. This is collected for stateless and stateful session beans and entity beans if monitoring enabled is true for EJB container. |
Use the following dotted name pattern for EJB pool statistics:
server.applications.appname.ejbmodulename.bean-pool.ejbname.statistic
The statistics available for EJB pools are listed in the following table.
Table 8–8 EJB Pool Monitoring Statistics
Statistic |
Data Type |
Description |
---|---|---|
jmsmaxmessagesload |
CountStatistic |
The maximum number of messages to load into a JMS session at one time for a message-driven bean to serve. Default is 1. Applies only to pools for message driven beans. |
numbeansinpool |
RangeStatistic |
Number of EJBs in the associated pool, providing information about how the pool is changing. |
numthreadswaiting |
RangeStatistic |
Number of threads waiting for free beans, giving an indication of possible congestion of requests. |
totalbeanscreated |
CountStatistic |
Number of beans created in associated pool since the gathering of data started. |
totalbeansdestroyed |
CountStatistic |
Number of beans destroyed from associated pool since the gathering of data started. |
Use the following dotted name pattern for timer statistics:
server.applications.appname.ejbmodulename.timers.ejbname.statistic
The statistics available for timers are listed in the following table.
Table 8–9 Timer Monitoring Statistics
Statistic |
Data Type |
Description |
---|---|---|
numtimerscreated |
CountStatistic |
Number of timers created in the system. |
numtimersdelivered |
CountStatistic |
Number of timers delivered by the system. |
numtimersremoved |
CountStatistic |
Number of timers removed from the system. |
The HTTP service fits into the tree of objects as shown in HTTP Service Tree Hierarchy.
Use the following dotted name pattern for HTTP service virtual server statistics:
server.http-service.virtual-server.request.statistic
The HTTP service statistics for virtual servers are shown in the following table.
Table 8–10 HTTP Service Virtual Server Monitoring Statistics
Statistic |
Data Type |
Description |
---|---|---|
count200 |
CountStatistic |
Number of responses with a status code equal to 200 |
count2xx |
CountStatistic |
Number of responses with a status code in the 2xx range |
count302 |
CountStatistic |
Number of responses with a status code equal to 302 |
count304 |
CountStatistic |
Number of responses with a status code equal to 304 |
count3xx |
CountStatistic |
Number of responses with a status code equal in the 3xx range |
count400 |
CountStatistic |
Number of responses with a status code equal to 400 |
count401 |
CountStatistic |
Number of responses with a status code equal to 401 |
count403 |
CountStatistic |
Number of responses with a status code equal to 403 |
count404 |
CountStatistic |
Number of responses with a status code equal to 404 |
count4xx |
CountStatistic |
Number of responses with a status code equal in the 4xx range |
count503 |
CountStatistic |
Number of responses with a status code equal to 503 |
count5xx |
CountStatistic |
Number of responses with a status code equal in the 5xx range |
countother |
CountStatistic |
Number of responses with a status code outside the 2xx, 3xx, 4xx, and 5xx range |
errorcount |
CountStatistic |
Cumulative value of the error count, with error count representing the number of cases where the response code was greater than or equal to 400 |
hosts |
StringStatistic |
The host (alias) names of the virtual server |
maxtime |
CountStatistic |
Longest response time for a request; not a cumulative value, but the largest response time from among the response times |
processingtime |
CountStatistic |
Cumulative value of the times taken to process each request, with processing time being the average of request processing times over the request count |
requestcount |
CountStatistic |
Cumulative number of requests processed so far |
state |
StringStatistic |
The state of the virtual server |
Jersey fits into the tree of objects as shown in Applications Tree Hierarchy.
Use the following dotted name pattern for Jersey statistics:
server.applications.jersey-application.jersey.resources.resource-0.hitcount.statistic
The statistics available for Jersey are shown in the following table.
Table 8–11 Jersey Statistics
Statistic |
Data Type |
Description |
---|---|---|
resourcehitcount |
CountStatistic |
Number of hits on this resource class |
rootresourcehitcount |
CountStatistic |
Number of hits on this root resource class |
The JMS/Connector Service fits into the tree of objects as shown in JMS/Container Service Tree Hierarchy.
JMS/Connector Service statistics are shown in the following sections:
Use the following dotted name pattern for JMS/Connector Service connection pool statistics:
server.connector-service.resource-adapter-1.connection-pool.statistic
JMS/Connector Service statistics available for the connector connection pools are shown in the following table.
Table 8–12 Connector Connection Pool Monitoring Statistics (JMS)
Statistic |
Data Type |
Description |
---|---|---|
averageconnwaittime |
CountStatistic |
Average wait time of connections before they are serviced by the connection pool. |
connectionrequestwaittime |
RangeStatistic |
The longest and shortest wait times of connection requests. The current value indicates the wait time of the last request that was serviced by the pool. |
numconnfailedvalidation |
CountStatistic |
Total number of connections in the connection pool that failed validation from the start time until the last sample time. |
numconnused |
RangeStatistic |
Total number of connections that are currently being used, as well as information about the maximum number of connections that were used (the high water mark). |
numconnfree |
RangeStatistic |
Total number of free connections in the pool as of the last sampling. |
numconntimedout |
CountStatistic |
Total number of connections in the pool that timed out between the start time and the last sample time. |
numconncreated |
CountStatistic |
Number of physical connections, in milliseconds, that were created since the last reset. |
numconndestroyed |
CountStatistic |
Number of physical connections that were destroyed since the last reset. |
numconnacquired |
CountStatistic |
Number of logical connections acquired from the pool. |
numconnreleased |
CountStatistic |
Number of logical connections released to the pool. |
waitqueuelenght |
CountStatistic |
Number of connection requests in the queue waiting to be serviced. |
Use the following dotted name pattern for JMS/Connector Service work management statistics:
server.connector-service.resource-adapter-1.work-management.statistic
JMS/Connector Service statistics available for connector work management are listed in the following table.
Table 8–13 Connector Work Management Monitoring Statistics (JMS)
Statistic |
Data Type |
Description |
---|---|---|
activeworkcount |
RangeStatistic |
Number of work objects executed by the connector. |
completedworkcount |
CountStatistic |
Number of work objects that were completed. |
rejectedworkcount |
CountStatistic |
Number of work objects rejected by the GlassFish Server. |
submittedworkcount |
CountStatistic |
Number of work objects submitted by a connector module. |
waitqueuelength |
RangeStatistic |
Number of work objects waiting in the queue before executing. |
workrequestwaittime |
RangeStatistic |
Longest and shortest wait of a work object before it gets executed. |
JRuby fits into the tree of objects as show in JRuby Tree Hierarchy.
The statistics that are available for JRuby are shown in the following sections:
Use the following dotted name pattern for JRuby container statistics:
server.containers.jruby.applications.jruby-application.statistic
The statistics that are available for the JRuby container are shown in the following table.
Table 8–14 JRuby Container Statistics
Statistic |
Data Type |
Description |
---|---|---|
environment |
StringStatistic |
JRuby application environment |
appname |
StringStatistic |
Ruby application name |
contextpath |
StringStatistic |
Context path of Ruby application |
jrubyversion |
StringStatistic |
JRuby version |
rubyframework |
StringStatistic |
Ruby application framework |
Use the following dotted name pattern for JRuby runtime statistics:
server.containers.jruby.applications.jruby-application.runtime.statistic
The statistics that are available for the JRuby runtime are shown in the following table.
Table 8–15 JRuby Runtime Statistics
Statistic |
Data Type |
Description |
---|---|---|
activeruntimes |
CountStatistic |
Currently active runtimes |
appname |
StringStatistic |
Ruby application name |
hardmaximum |
CountStatistic |
Maximum active runtimes |
hardminimum |
CountStatistic |
Minimum active runtimes |
Use the following dotted name pattern for JRuby HTTP service statistics:
server.containers.jruby.applications.jruby-application.http.statistic
The statistics that are available for the JRuby HTTP service are shown in the following table.
Table 8–16 JRuby HTTP Service Statistics
Statistic |
Data Type |
Description |
---|---|---|
address |
StringStatistic |
Server address |
appname |
StringStatistic |
Ruby application name |
averageprocessingtime |
CountStatistic |
Average request processing time in milliseconds |
contextpath |
StringStatistic |
Context path of Ruby application |
count2xx |
CountStatistic |
Number of responses with a status code in the 2xx range |
count200 |
CountStatistic |
Number of responses with a status code equal to 200 |
count3xx |
CountStatistic |
Number of responses with a status code in the 3xx range |
count302 |
CountStatistic |
Number of responses with a status code equal to 302 |
Count304 |
CountStatistic |
Number of responses with a status code equal to 304 |
count4xx |
CountStatistic |
Number of responses with a status code in the 4xx range |
count400 |
CountStatistic |
Number of responses with a status code equal to 400 |
count401 |
CountStatistic |
Number of responses with a status code equal to 401 |
count403 |
CountStatistic |
Number of responses with a status code equal to 403 |
count404 |
CountStatistic |
Number of responses with a status code equal to 404 |
count5xx |
CountStatistic |
Number of responses with a status code in the 5xx range |
count503 |
CountStatistic |
Number of responses with a status code equal to 503 |
countother |
CountStatistic |
Number of responses with other status codes |
errorcount |
CountStatistic |
Number of responses with a status code greater than 400 |
requests/seconds |
CountStatistic |
Requests per second |
The JVM fits into the tree of objects as show in JVM Tree Hierarchy.
The statistics that are available for the Virtual Machine for Java platform (Java Virtual Machine) or JVM machine are shown in the following sections:
Use the following dotted name pattern for JVM class loading system statistics:
server.jvm.class-loading-system.statistic
With Java SE, additional monitoring information can be obtained from the JVM. Set the monitoring level to LOW to enable the display of this additional information. Set the monitoring level to HIGH to also view information pertaining to each live thread in the system. More information about the additional monitoring features for Java SE is available in Monitoring and Management for the Java Platform.
The Java SE monitoring tools are discussed at http://download.oracle.com/docs/cd/E17409_01/javase/6/docs/technotes/tools/.
The statistics that are available for class loading in the JVM for Java SE are shown in the following table.
Table 8–17 JVM Monitoring Statistics for Java SE Class Loading
Statistic |
Data Type |
Description |
---|---|---|
loadedclasscount |
CountStatistic |
Number of classes that are currently loaded in the JVM |
totalloadedclasscount |
CountStatistic |
Total number of classes that have been loaded since the JVM began execution |
unloadedclasscount |
CountStatistic |
Number of classes that have been unloaded from the JVM since the JVM began execution |
The statistics available for threads in the JVM in Java SE are shown in the following table.
Table 8–18 JVM Monitoring Statistics for Java SE - Threads
Statistic |
Data Type |
Description |
---|---|---|
allthreadids |
StringStatistic |
List of all live thread ids. |
currentthreadcputime |
CountStatistic |
CPU time for the current thread (in nanoseconds) if CPU time measurement is enabled. If CPU time measurement is disabled, returns -1. |
daemonthreadcount |
CountStatistic |
Current number of live daemon threads. |
monitordeadlockedthreads |
StringStatistic |
List of thread ids that are monitor deadlocked. |
peakthreadcount |
CountStatistic |
Peak live thread count since the JVM started or the peak was reset. |
threadcount |
CountStatistic |
Current number of live daemon and non-daemon threads. |
totalstartedthreadcount |
CountStatistic |
Total number of threads created and/or started since the JVM started. |
Use the following dotted name pattern for JVM compilation system statistics:
server.jvm.compilation-system.statistic
The statistics that are available for compilation in the JVM for Java SE are shown in the following table.
Table 8–19 JVM Monitoring Statistics for Java SE Compilation
Statistic |
Data Type |
Description |
---|---|---|
name-current |
StringStatistic |
Name of the current compiler |
totalcompilationtime |
CountStatistic |
Accumulated time (in milliseconds) spent in compilation |
Use the following dotted name pattern for JVM garbage collectors statistics:
server.jvm.garbage-collectors.statistic
The statistics that are available for garbage collection in the JVM for Java SE are shown in the following table.
Table 8–20 JVM Monitoring Statistics for Java SE Garbage Collectors
Statistic |
Data Type |
Description |
---|---|---|
collectioncount |
CountStatistic |
Total number of collections that have occurred |
collectiontime |
CountStatistic |
Accumulated time (in milliseconds) spent in collection |
Use the following dotted name pattern for JVM memory statistics:
server.jvm.memory.statistic
The statistics that are available for memory in the JVM for Java SE are shown in the following table.
Table 8–21 JVM Monitoring Statistics for Java SE Memory
Statistic |
Data Type |
Description |
---|---|---|
committedheapsize |
CountStatistic |
Amount of heap memory (in bytes) that is committed for the JVM to use |
committednonheapsize |
CountStatistic |
Amount of non-heap memory (in bytes) that is committed for the JVM to use |
initheapsize |
CountStatistic |
Size of the heap initially requested by the JVM |
initnonheapsize |
CountStatistic |
Size of the non-heap area initially requested by the JVM |
maxheapsize |
CountStatistic |
Maximum amount of heap memory (in bytes) that can be used for memory management |
maxnonheapsize |
CountStatistic |
Maximum amount of non-heap memory (in bytes) that can be used for memory management |
objectpendingfinalizationcount |
CountStatistic |
Approximate number of objects that are pending finalization |
usedheapsize |
CountStatistic |
Size of the heap currently in use |
usednonheapsize |
CountStatistic |
Size of the non-heap area currently in use |
Use the following dotted name pattern for JVM operating system statistics:
server.jvm.operating-system.statistic
The statistics that are available for the operating system for the JVM machine in Java SE are shown in the following table.
Table 8–22 JVM Statistics for the Java SE Operating System
Statistic |
Data Type |
Description |
---|---|---|
arch-current |
StringStatistic |
Operating system architecture |
availableprocessors |
CountStatistic |
Number of processors available to the JVM |
name-current |
StringStatistic |
Operating system name |
version-current |
StringStatistic |
Operating system version |
Use the following dotted name pattern for JVM runtime statistics:
server.jvm.runtime.statistic
The statistics that are available for the runtime in the JVM runtime for Java SE are shown in the following table.
Table 8–23 JVM Monitoring Statistics for Java SE Runtime
Statistic |
Data Type |
Description |
---|---|---|
classpath-current |
StringStatistic |
Classpath that is used by the system class loader to search for class files |
inputarguments-current |
StringStatistic |
Input arguments passed to the JVM; not including arguments to the main method |
managementspecversion-current |
StringStatistic |
Management specification version implemented by the JVM |
name-current |
StringStatistic |
Name representing the running JVM |
specname-current |
StringStatistic |
JVM specification name |
specvendor-current |
StringStatistic |
JVM specification vendor |
specversion-current |
StringStatistic |
JVM specification version |
uptime |
CountStatistic |
Uptime of the JVM (in milliseconds) |
vmname-current |
StringStatistic |
JVM implementation name |
vmvendor-current |
StringStatistic |
JVM implementation vendor |
vmversion-current |
StringStatistic |
JVM implementation version |
Network fits into the tree of objects as shown in Network Tree Hierarchy.
Network statistics are described in the following sections:
Use the following dotted name pattern for network keep alive statistics:
server.network.type-of-listener.keep-alive.statistic
Statistics available for network keep alive are shown in the following table.
Table 8–24 Network Keep Alive Statistics
Statistic |
Data Type |
Description |
---|---|---|
countconnections |
CountStatistic |
Number of connections in keep-alive mode. |
counttimeouts |
CountStatistic |
Number of keep-alive connections that timed out. |
secondstimeouts |
CountStatistic |
Keep-alive timeout value in seconds. |
maxrequests |
CountStatistic |
Maximum number of requests allowed on a single keep-alive connection. |
countflushes |
CountStatistic |
Number of keep-alive connections that were closed. |
counthits |
CountStatistic |
Number of requests received by connections in keep-alive mode. |
countrefusals |
CountStatistic |
Number of keep-alive connections that were rejected. |
Use the following dotted name pattern for network connection queue statistics:
server.network.type-of-listener.connection-queue.statistic
Statistics available for network connection queue are shown in the following table.
Table 8–25 Network Connection Queue Statistics
Statistic |
Data Type |
Description |
---|---|---|
countopenconnections |
CountStatistic |
The number of open/active connections |
countoverflows |
CountStatistic |
Number of times the queue has been too full to accommodate a connection |
countqueued |
CountStatistic |
Number of connections currently in the queue |
countqueued15minutesaverage |
CountStatistic |
Average number of connections queued in the last 15 minutes |
countqueued1minuteaverage |
CountStatistic |
Average number of connections queued in the last 1 minute |
countqueued5minutesaverage |
CountStatistic |
Average number of connections queued in the last 5 minutes |
counttotalconnections |
CountStatistic |
Total number of connections that have been accepted |
counttotalqueued |
CountStatistic |
Total number of connections that have been queued |
maxqueued |
CountStatistic |
Maximum size of the connection queue |
peakqueued |
CountStatistic |
Largest number of connections that were in the queue simultaneously |
tickstotalqueued |
CountStatistic |
(Unsupported) Total number of ticks that connections have spent in the queue |
Use the following dotted name pattern for network file cache statistics:
server.network.type-of-listener.file-cache.statistic
Statistics available for network file cache are shown in the following table.
Table 8–26 Network File Cache Statistics
Statistic |
Data Type |
Description |
---|---|---|
contenthits |
CountStatistic |
Number of hits on cached file content |
contentmisses |
CountStatistic |
Number of misses on cached file content |
heapsize |
CountStatistic |
Current cache size in bytes |
hits |
CountStatistic |
Number of cache lookup hits |
infohits |
CountStatistic |
Number of hits on cached file info |
infomisses |
CountStatistic |
Number of misses on cached file info |
mappedmemorysize |
CountStatistic |
Size of mapped memory used for caching in bytes |
maxheapsize |
CountStatistic |
Maximum heap space used for cache in bytes |
maxmappedmemorysize |
CountStatistic |
Maximum memory map size used for caching in bytes |
misses |
CountStatistic |
Number of cache lookup misses data type |
opencacheentries |
CountStatistic |
Number of current open cache entries |
Use the following dotted name pattern for network thread pool statistics:
server.network.type-of-listener.thread-pool.statistic
Statistics available for network thread pool are shown in the following table.
Table 8–27 Network Thread Pool Statistics
Statistic |
Data Type |
Description |
---|---|---|
corethreads |
CountStatistic |
Core number of threads in the thread pool |
currentthreadcount |
CountStatistic |
Provides the number of request processing threads currently in the listener thread pool |
currentthreadsbusy |
CountStatistic |
Provides the number of request processing threads currently in use in the listener thread pool serving requests |
maxthreads |
CountStatistic |
Maximum number of threads allowed in the thread pool |
totalexecutedtasks |
CountStatistic |
Provides the total number of tasks, which were executed by the thread pool |
The ORB fits into the tree of objects as shown in ORB Tree Hierarchy.
Use the following dotted name patterns for ORB statistics:
server.orb.transport.connectioncache.inbound.statistic server.orb.transport.connectioncache.outbound.statistic
The statistics available for the connection manager in an ORB are listed in the following table.
Table 8–28 ORB Monitoring Statistics (Connection Manager)
Statistic |
Data Type |
Description |
---|---|---|
connectionsidle |
CountStatistic |
Total number of connections that are idle to the ORB |
connectionsinuse |
CountStatistic |
Total number of connections in use to the ORB |
totalconnections |
BoundedRangeStatistic |
Total number of connections to the ORB |
By monitoring connection pool resources you can measure performance and capture resource usage at runtime. Connections are expensive and frequently cause performance bottlenecks in applications. It is important to monitor how a connection pool is releasing and creating new connections and how many threads are waiting to retrieve a connection from a particular pool.
The connection pool resources fit into the tree of objects as shown in Resources Tree Hierarchy.
Use the following dotted name pattern for connection pool statistics:
server.resources.connection-pool.statistic
The connection pool statistics are shown in the following table.
Table 8–29 Resource Monitoring Statistics (Connection Pool)
Statistic |
Data Type |
Description |
---|---|---|
averageconnwaittime |
CountStatistic |
Average wait-time-duration per successful connection request |
connrequestwaittime |
RangeStatistic |
Longest and shortest wait times, in milliseconds, of connection requests since the last sampling. current value indicates the wait time of the last request that was serviced by the pool |
numconnfailedvalidation |
CountStatistic |
Number of connections in the connection pool that failed validation from the start time until the last sampling time |
numconnused |
RangeStatistic |
Number of connections that are currently being used, as well as information about the maximum number of connections that were used (high water mark) |
numconnfree |
RangeStatistic |
Number of free connections in the pool as of the last sampling |
numconntimedout |
CountStatistic |
Number of connections in the pool that timed out between the start time and the last sampling time |
numconncreated |
CountStatistic |
Number of physical connections that were created by the pool since the last reset |
numconndestroyed |
CountStatistic |
Number of physical connections that were destroyed since the last reset |
numconnacquired |
CountStatistic |
Number of logical connections acquired from the pool since the last sampling |
numconnreleased |
CountStatistic |
Number of connections released back to the pool since the last sampling |
numconnnotsuccessfullymatched |
CountStatistic |
Number of connections rejected during matching |
numconnsuccessfullymatched |
CountStatistic |
Number of connections successfully matched |
numpotentialconnleak |
CountStatistic |
Number of potential connection leaks |
waitqueuelength |
CountStatistic |
Number of connection requests in the queue waiting to be serviced |
Security fits into the tree of objects as shown in Security Tree Hierarchy.
Statistics available for security are shown in the following sections:
Use the following dotted name pattern for EJB security statistics:
server.security.ejb.statistic
The statistics available for EJB security are listed in the following table.
Table 8–30 EJB Security Monitoring Statistics
Statistic |
Data Type |
Description |
---|---|---|
policyconfigurationcount |
CountStatistic |
Number of policy configuration |
securitymanagercount |
CountStatistic |
Number of EJB security managers |
Use the following dotted name pattern for web security statistics:
server.security.web.statistic
The statistics available for web security are listed in the following table.
Table 8–31 Web Security Monitoring Statistics
Statistic |
Data Type |
Description |
---|---|---|
websecuritymanagercount |
CountStatistic |
Number of security managers |
webpolicyconfigurationcount |
CountStatistic |
Number of policy configuration objects |
Use the following dotted name pattern for realm security statistics:
server.security.realm.statistic
The statistics available for realm security are listed in the following table.
Table 8–32 Realm Security Monitoring Statistics
Statistic |
Data Type |
Description |
---|---|---|
realmcount |
CountStatistic |
Number of realms |
The thread pool fits into the tree of objects as shown in Thread Pool Tree Hierarchy.
The statistics available for thread pools are shown in the following sections:
Use the following dotted name pattern for thread pool statistics:
server.thread-pool.thread-pool.statistic
The statistics available for the thread pool are shown in the following table.
Table 8–33 Thread Pool Monitoring Statistics
Statistic |
Data Type |
Description |
---|---|---|
averagetimeinqueue |
BoundedRangeStatistic |
Average amount of time (in milliseconds) a request waited in the queue before being processed |
averageworkcompletiontime |
BoundedRangeStatistic |
Average amount of time (in milliseconds) taken to complete an assignment |
currentbusythreads |
CountStatistic |
Number of busy threads |
currentnumberofthreads |
BoundedRangeStatistic |
Current number of request processing threads |
numberofavailablethreads |
CountStatistic |
Number of available threads |
numberofworkitemsinqueue |
BoundedRangeStatistic |
Current number of work items waiting in queue |
totalworkitemsadded |
CountStatistic |
Total number of work items added to the work queue as of last sampling |
The statistics available for ThreadInfo in the JVM in Java SE are shown in the following table.
Table 8–34 JVM Monitoring Statistics for Java SE - Thread Info
Statistic |
Data Type |
Description |
---|---|---|
blockedcount |
CountStatistic |
Total number of times that the thread entered the BLOCKED state. |
blockedtime |
CountStatistic |
Time elapsed (in milliseconds) since the thread entered the BLOCKED state. Returns -1 if thread contention monitoring is disabled. |
lockname |
StringStatistic |
String representation of the monitor lock that the thread is blocked to enter or waiting to be notified through the Object.wait method. |
lockownerid |
CountStatistic |
ID of the thread that holds the monitor lock of an object on which this thread is blocking. |
lockownername |
StringStatistic |
Name of the thread that holds the monitor lock of the object this thread is blocking on. |
stacktrace |
StringStatistic |
Stack trace associated with this thread. |
threadid |
CountStatistic |
ID of the thread. |
threadname |
StringStatistic |
Name of the thread. |
threadstate |
StringStatistic |
State of the thread. |
waitedtime |
CountStatistic |
Elapsed time (in milliseconds) that the thread has been in a WAITING state. Returns -1 if thread contention monitoring is disabled. |
waitedcount |
CountStatistic |
Total number of times the thread was in WAITING or TIMED_WAITING states. |
The transaction service allows the client to freeze the transaction subsystem in order to roll back transactions and determine which transactions are in process at the time of the freeze. The transaction service fits into the tree of objects as shown in Transactions Service Tree Hierarchy.
Use the following dotted name pattern for transaction service statistics:
server.transaction-service.statistic
The statistics available for the transaction service are shown in the following table.
Table 8–35 Transaction Service Monitoring Statistics
Statistic |
Data Type |
Description |
---|---|---|
activecount |
CountStatistic |
Number of transactions currently active. |
activeids |
StringStatistic |
The ID’s of the transactions that are currently active. Every such transaction can be rolled back after freezing the transaction service. |
committedcount |
CountStatistic |
Number of transactions that have been committed. |
rolledbackcount |
CountStatistic |
Number of transactions that have been rolled back. |
state |
StringStatistic |
Indicates whether or not the transaction has been frozen. |
The web module fits into the tree of objects as shown in Web Tree Hierarchy.
The available web statistics shown in the following sections:
Use the following dotted name pattern for web module servlet statistics:
server.applications.web-module.virtual-server.servlet.statistic server.applications.application.web-module.virtual-server.servlet.statistic
The available web module servlet statistics are shown in the following table.
Table 8–36 Web Module Servlet Statistics
Statistic |
Data Type |
Description |
---|---|---|
errorcount |
CountStatistic |
Cumulative number of cases where the response code is greater than or equal to 400. |
maxtime |
CountStatistic |
Maximum amount of time the web container waits for requests. |
processingtime |
CountStatistic |
Cumulative value of the amount of time required to process each request. The processing time is the average of request processing times divided by the request count. |
requestcount |
CountStatistic |
The total number of requests processed so far. |
servicetime |
CountStatistic |
Aggregate response time in milliseconds. |
Use the following dotted name pattern for web JSP statistics:
server.applications.web-module.virtual-server.statistic server.applications.application.web-module.virtual-server.statistic
The available web JSP statistics are shown in the following table.
Table 8–37 Web JSP Monitoring Statistics
Statistic |
Data Type |
Description |
---|---|---|
jspcount-current |
RangeStatistic |
Number of active JSP pages |
jsperrorcount |
CountStatistic |
Total number of errors triggered by JSP page invocations |
jspreloadedcount |
CountStatistic |
Total number of JSP pages that were reloaded |
totaljspcount |
CountStatistic |
Total number of JSP pages ever loaded |
Use the following dotted name pattern for web request statistics:
server.applications.web-module.virtual-server.statistic server.applications.application.web-module.virtual-server.statistic
The available web request statistics are shown in the following table.
Table 8–38 Web Request Monitoring Statistics
Statistic |
Data Type |
Description |
---|---|---|
errorcount |
CountStatistic |
Cumulative value of the error count, with error count representing the number of cases where the response code was greater than or equal to 400 |
maxtime |
CountStatistic |
Longest response time for a request; not a cumulative value, but the largest response time from among the response times |
processingtime |
CountStatistic |
Average request processing time, in milliseconds |
requestcount |
CountStatistic |
Cumulative number of the requests processed so far |
Use the following dotted name pattern for web servlet statistics:
server.applications.web-module.virtual-server.statistic server.applications.application.web-module.virtual-server.statistic
The available web servlet statistics are shown in the following table.
Table 8–39 Web Servlet Monitoring Statistics
Statistic |
Data Type |
Description |
---|---|---|
activeservletsloadedcount |
RangeStatistic |
Number of currently loaded servlets |
servletprocessingtimes |
CountStatistic |
Cumulative servlet processing times , in milliseconds |
totalservletsloadedcount |
CountStatistic |
Cumulative number of servlets that have been loaded into the web module |
Use the following dotted name pattern for web session statistics:
server.applications.web-module.virtual-server.statistic server.applications.application.web-module.virtual-server.statistic
The available web session statistics are shown in the following table.
Table 8–40 Web Session Monitoring Statistics
Statistic |
Data Type |
Description |
---|---|---|
activatedsessionstotal |
CountStatistic |
Total number of activated sessions |
activesessionscurrent |
RangeStatistic |
Number of currently active sessions |
activesessionshigh |
CountStatistic |
Maximum number of concurrently active sessions |
expiredsessionstotal |
CountStatistic |
Total number of expired sessions |
passivatedsessionstotal |
CountStatistic |
Total number of passivated sessions |
persistedsessionstotal |
CountStatistic |
Total number of persisted sessions |
rejectedsessionstotal |
CountStatistic |
Total number of rejected sessions |
sessionstotal |
CountStatistic |
Total number of sessions created |
Java SE provides tools to connect to an MBean Server and view the MBeans registered with the server. JConsole is one such popular JMX Connector Client and is available as part of the standard Java SE distribution. When you configure JConsole for use with GlassFish Server, GlassFish Server becomes the JMX Connector's server end and JConsole becomes the JMX connector's client end.
Java SE 6 enhances management and monitoring of the virtual machine by including a Platform MBean Server and by including managed beans (MBeans) to configure the virtual machine.
To view all MBeans, GlassFish Server provides a configuration of the standard JMX connector server called System JMX Connector Server. As part of GlassFish Server startup, an instance of this JMX Connector Server is started. Any compliant JMX connector client can connect to the server using the JMX Connector Server.
By default, GlassFish Server is configured with a non-secure System JMX Connector Server. If this is an issue, the JMX connector can be removed. However, access can be restricted to a specific IP address (for example, the loopback address) by setting address to locahost.
Start the domain.
For instructions, see To Start a Domain.
Start JConsole using this format: JDK_HOME/bin/jconsole
For example:
/usr/java/bin/jconsole |
The JConsole Connect to Agent window is displayed.
Click the Remote tab and type the host name and port.
Always connect remotely with JConsole, otherwise MBeans will not load automatically.
Click Connect.
In the Remote Process text box, specify the JMX Service URL.
For example:
service:jmx:rmi:///jndi/rmi://localhost:8686/jmxrmi |
The JMX Service URL is emitted by the server at startup, looking something like this:
[#|2009-12-03T10:25:17.737-0800|INFO|glassfishv3.0| x..system.tools.admin.org.glassfish.server|_ThreadID=20; _ThreadName=Thread-26;|JMXStartupService: Started JMXConnector, JMXService URL = service:jmx:rmi://localhost:8686/jndi/rmi://localhost:8686/jmxrmi|#] |
However, in most cases, simply entering host:port is fine, such as, 192.168.1.150:8686. The long Service URL is not needed.
Another host name can be substituted for localhost. The default port number (8686) could change if the jmx-connector configuration has been modified.
Click Connect.
In the JConsole window you will see all your MBeans, JVM information, and so on, in various tabs. Most of the useful MBeans are to be found in the amx and java.lang domains.
For more information about JConsole, see http://download.oracle.com/docs/cd/E17409_01/javase/6/docs/technotes/guides/management/jconsole.html.
This chapter provides procedures for administering life cycle modules in the OracleGlassFish Server 3.0.1 environment.
The following topics are addressed here:
Instructions for accomplishing the tasks in this chapter by using the Administration Console are contained in the Administration Console online help.
Life cycle modules, also known as initialization services, provide a means of running short or long duration Java-based tasks within the GlassFish Server environment. These modules are automatically initiated at server startup and are notified at various phases of the server life cycle. Configured properties for a life cycle module are passed as properties during server initialization.
All life cycle module classes and interfaces are in the as-install/glassfish/modules/glassfish-api.jar file.
A life cycle module listens for and performs its tasks in response to the following GlassFish Server sequence of events:
Initialization. The server reads the configuration, initializes built-in subsystems (such as security and logging services), and creates the containers.
Startup. The server loads and initializes deployed applications.
Ready. The server begins servicing requests.
Shutdown. The server shuts down the applications and stops.
Termination. The server closes the containers, the built-in subsystems, and the server runtime environment.
These events are defined in the LifecycleEvent class. For information on creating life cycle modules, see Chapter 13, Developing Lifecycle Listeners, in Oracle GlassFish Server 3.0.1 Application Development Guide.
If the is-failure-fatal setting is set to true (the default is false), life cycle module failure prevents server initialization or startup, but not shutdown or termination.
The following topics are addressed here:
Use the create-lifecycle-module subcommand in remote mode to create a life cycle module.
Ensure that the server is running.
Remote subcommands require a running server.
Create a new life cycle modules by using the create-lifecycle-module(1) subcommand.
Information about options and properties for the subcommand are included in this help page.
Restart the server for your changes to take effect.
See To Restart a Domain.
This example creates the customSetup life cycle module :
asadmin> create-lifecycle-module --classname "com.acme.CustomSetup" --classpath "/export/customSetup" --loadorder 1 --failurefatal=true --description "this is a sample customSetup" --property rmi="Server\=acme1\:7070":timeout=30 customSetup Command create-lifecycle-module executed successfully |
You can also view the full syntax and options of the subcommand by typing asadmin help create-lifecycle-module at the command line.
Use the list-lifecycle-modules subcommand in remote mode to list the existing life cycle modules.
Ensure that the server is running.
Remote subcommands require a running server.
List life cycle modules by using the list-lifecycle-modules(1) subcommand.
This example lists the existing life cycle modules.
asadmin> list-lifecycle-modules WSTCPConnectorLCModule Command list-lifecycle-modules executed successfully |
You can also view the full syntax and options of the subcommand by typing asadmin help list-lifecycle-modules at the command line.
Use the set subcommand to update an existing life cycle module.
List the properties that can be updated for a life cycle module by using the get(1) subcommand.
For example (single mode):
asadmin get "*" | grep sampleLCM applications.application.sampleLCMmodule.availability-enabled=false applications.application.sampleLCMmodule.directory-deployed=false applications.application.sampleLCMmodule.enabled=true applications.application.sampleLCMmodule.name=sampleLCMmodule applications.application.sampleLCMmodule.object-type=user applications.application.sampleLCMmodule.property.class-name=example.lc.SampleModule applications.application.sampleLCMmodule.property.classpath=/build/lcm.jar applications.application.sampleLCMmodule.property.is-failure-fatal=false applications.application.sampleLCMmodule.property.isLifecycle=true |
Update a life cycle module by using the set(1) subcommand.
Restart the server for your changes to take effect.
See To Restart a Domain.
This example updates the classpath property.
sadmin> set applications.application.sampleLCMmodule. property.classpath=/build/lcm_new.jarapplications.application. sampleLCMmodule.property.classpath=/build/lcm_new.jar Command set executed successfully. |
You can also view the full syntax and options of the subcommand by typing asadmin help set at the command line.
Use the delete-lifecycle-module subcommand in remote mode to delete a life cycle module.
Ensure that the server is running.
Remote subcommands require a running server.
List the current life cycle modules by using the list-lifecycle-modules(1) subcommand.
Delete a life cycle module by using the delete-lifecycle-module(1) subcommand.
This example deletes the customSetup life cycle module.
asadmin> delete-lifecycle-module customSetup Command delete-lifecycle-module executed successfully |
You can also view the full syntax and options of the subcommand by typing asadmin help delete-lifecycle-module at the command line.
This chapter explains how to extend and update a deployed Oracle GlassFish Server 3.0.1 installation.
The following topics are addressed here:
Upgrading to Oracle GlassFish Server From GlassFish Server Open Source Edition
Extending and Updating GlassFish Server Inside a Closed Network
GlassFish Server is designed to provide its functionality in a modular form so that you can choose to include the functionality that you need and leave out the functionality that is not needed. OSGi modules, also called bundles, provide add-on functionality for your deployed GlassFish Server. As new add-on components are developed and existing components are modified, you can extend and update GlassFish Server by installing these components. You can add components during runtime, without stopping the server. But you must stop the server before updating or removing an installed component.
Image Packaging System (IPS) tools for updating GlassFish Server software obtain updates from repositories that contain the OSGi modules and other content for GlassFish Server.
Oracle GlassFish Server and GlassFish Server Open Source Edition each have their own set of repositories, as explained in the following sections:
Table 10–1 lists the preconfigured repositories for Oracle GlassFish Server.
Table 10–1 Oracle GlassFish Server Preconfigured Repositories
Publisher |
URL |
Description |
---|---|---|
pkg.sun.com/glassfish/v3/release/ |
Commercial, production quality versions of the core components and add-on components of Oracle GlassFish Server |
|
pkg.sun.com/glassfish/v3/contrib/ |
Additional add-on components that are contributed by Oracle partners |
|
pkg.glassfish.org/v3/contrib/ |
Additional add-on components that are contributed by the GlassFish community |
|
pkg.sun.com/glassfish/v3/dev/ |
Developmental, beta, and prerelease versions of the components in the pkg.sun.com/glassfish/v3/release/ repository |
For Oracle GlassFish Server installations, the release.glassfish.sun.com publisher is designated as the preferred publisher. To ensure that installations contain only commercial, production quality version of components by default, the preferred publisher is treated specially by the tools for updating GlassFish Server software:
If an add-on component is available from the preferred publisher and from other publishers, the Update Tool GUI and the pkg CLI list and install the component from the preferred publisher.
After a component has been installed from the preferred publisher, the Update Tool, Software Update, and desktop notifier GUIs search for updates to that component only from the preferred publisher.
If you have support for Oracle GlassFish Server, you can acquire an SSL certificate and key to change the preferred publisher's repository URL from pkg.sun.com/glassfish/v3/release/ to pkg.sun.com/glassfish/v3/support/. This repository provides more frequent commercial, production quality updates. For more information, see the pkg.sun.com Certificate Generator.
Table 10–2 lists the preconfigured repositories for GlassFish Server Open Source Edition.
Table 10–2 GlassFish Server Open Source Edition Preconfigured Repositories
Publisher |
URL |
Description |
---|---|---|
pkg.sun.com/javaeesdk/6/release/ |
Production quality versions of the core components and add-on components of GlassFish Server Open Source Edition |
|
pkg.glassfish.org/v3/stable/ |
Most current stable pre-release build of core and add-on components |
|
pkg.sun.com/glassfish/v3/contrib/ |
Additional add-on components that are contributed by Oracle partners |
|
pkg.glassfish.org/v3/contrib/ |
Additional add-on components that are contributed by the GlassFish community |
|
pkg.glassfish.org/v3/dev/ |
Developmental, beta, and prerelease versions of the components in the pkg.sun.com/javaeesdk/6/release/ repository |
For GlassFish Server Open Source Edition installations, stable.glassfish.org is the preferred publisher.
GlassFish Server provides the following tools for updating software on a deployed server:
Update Tool is a standalone graphical tool bundled with GlassFish Server that can be used to find and install updates and add-ons on a deployed GlassFish Server instance.
To start Update Tool, type the following command:
as-install-parent/bin/updatetool |
For instructions for using Update Tool, see the Update Tool online help.
For additional information about Update Tool, see the following wikis:
The pkg command is the command-line equivalent to Update Tool. Most of the tasks that can be performed with the graphical Update Tool can be performed from a command line using the pkg tool.
The pkg command is located in the as-install-parent/bin directory. To run the pkg command without specifying the path, ensure that this directory is in your path.
The pkg command enables you to create update scripts and to update software on headless systems. A headless system does not have a monitor, graphics card, or keyboard.
Most of the procedures in this chapter are based on the pkg command. A set of reference pages that contain details about using the pkg command is included with GlassFish Serverin the as-install-parent/pkg/man directory.
The Administration Console enables you to perform the following tasks that are related to extending and updating GlassFish Server:
Installing add-on components
Viewing available updates to installed components
Viewing installed components
For more information, see the Administration Console online help.
The Administration Console does not enable you to update or remove installed components. Instead, you must stop the GlassFish Server domain and use Update Tool or the pkg command.
This section provides instructions for using the pkg command to install GlassFish Server add-on components on your deployed GlassFish Server.
The pkg command enables you to install an add-on component on your system. If multiple versions of a package are available, the latest one is applied unless you specify otherwise. The pkg command, located in the as-install-parent/bin directory,
If the pkg component, the updatetool component, or any other valid component that you try to invoke from the command line is not yet installed on your deployed GlassFish Server, you will receive a query asking if you want to install the component. Answer Y to install the component.
GlassFish Server 3.0.1 must be fully deployed before you can install additional components. If you need installation instructions, see Oracle GlassFish Server 3.0.1 Installation Guide.
To ensure that the pkg command can locate the application image, change to the base installation directory for GlassFish Server.
cd as-install |
The base installation directory for GlassFish Server.
List your installed components:
pkg list |
Information similar to the following is displayed:
NAME (PUBLISHER) VERSION STATE UFIX felix 2.0.2-0 installed u--- glassfish-appclient 3.0.1-14 installed u--- glassfish-cmp 3.0.1-14 installed u--- glassfish-common 3.0.1-14 installed u--- glassfish-common-full 3.0.1-14 installed u--- glassfish-corba 3.0.0-41 installed u--- glassfish-corba-base 3.0.0-41 installed u--- glassfish-ejb 3.0.1-14 installed u--- glassfish-ejb-lite 3.0.1-14 installed u--- glassfish-full-incorporation 3.0.1-14 installed u--- glassfish-full-profile 3.0.1-14 installed u--- glassfish-grizzly 1.9.18-9 installed u--- glassfish-grizzly-full 1.9.18-9 installed u--- glassfish-gui 3.0.1-14 installed u--- glassfish-hk2 3.0.1-14 installed u--- glassfish-javahelp 2.0.2-0 installed u--- glassfish-jca 3.0.1-14 installed u--- glassfish-jcdi 3.0.1-14 installed u--- glassfish-jdbc 3.0.1-14 installed u--- glassfish-jms 3.0.1-14 installed u--- glassfish-jpa 3.0.1-14 installed u--- glassfish-jsf 2.0.2-10 installed u--- glassfish-jta 3.0.1-14 installed u--- glassfish-jts 3.0.1-14 installed u--- glassfish-management 3.0.1-14 installed u--- glassfish-nucleus 3.0.1-14 installed u--- glassfish-registration 3.0.1-14 installed u--- glassfish-scripting 3.0.1-14 installed u--- glassfish-upgrade 3.0.1-14 installed u--- glassfish-web 3.0.1-14 installed u--- glassfish-web-incorporation 3.0.1-14 installed u--- glassfish-web-profile 3.0.1-14 installed u--- javadb-client 10.5.3.0-1 installed ---- javadb-common 10.5.3.0-1 installed ---- javadb-core 10.5.3.0-1 installed ---- jersey 1.1.5-1.0 installed u--- metro 2.0-29 installed u--- mq-bin-exe 4.4.2-2.7 installed ---- mq-bin-sh 4.4.2-2.7 installed ---- mq-config-gf 4.4.2-2.7 installed ---- mq-core 4.4.2-2.7 installed ---- mq-server 4.4.2-2.7 installed ---- pkg 1.122.2-38.2493 installed ---- pkg-java 1.122-38.2493 installed ---- pkg-toolkit-incorporation 2.3.0-38.2493 installed ---- python2.4-minimal 2.4.4.0-38.2493 installed ----
List all packages that are available:
pkg list -a |
Information similar to the following is displayed from the repository. For clarity, some items are omitted from this example.
NAME (PUBLISHER) VERSION STATE UFIX ant (contrib.glassfish.org) 1.7.1-0.6 known ---- felix (dev.glassfish.org) 2.0.2-0 known ---- felix 2.0.2-0 installed u--- felix (release.glassfish.sun.com) 2.0.2-0 known u--- glassfish-appclient (dev.glassfish.org) 3.0.1-15 known ---- glassfish-appclient 3.0.1-14 installed u--- glassfish-appclient (release.glassfish.sun.com) 3.0-74.2 known u--- glassfish-branding (release.glassfish.sun.com) 3.0-74.2 known ---- glassfish-branding-gui (release.glassfish.sun.com) 3.0-74.2 known ---- glassfish-cluster-util (contrib.glassfish.org) 1.0-0.0 known ---- glassfish-cmp (dev.glassfish.org) 3.0.1-15 known ---- glassfish-cmp 3.0.1-14 installed u--- glassfish-cmp (release.glassfish.sun.com) 3.0-74.2 known u--- ... metro (dev.glassfish.org) 2.0.1-3 known ---- metro 2.0-29 installed u--- metro (release.glassfish.sun.com) 2.0-29 known u--- mq-bin-exe 4.4.2-2.7 installed ---- mq-bin-exe (dev.glassfish.org) 4.4.2-2.7 known ---- mq-bin-exe (release.glassfish.sun.com) 4.4.1-7.2 known u--- mq-bin-sh 4.4.2-2.7 installed ---- mq-bin-sh (dev.glassfish.org) 4.4.2-2.7 known ---- mq-bin-sh (release.glassfish.sun.com) 4.4.1-7.2 known u--- mq-branding (release.glassfish.sun.com) 4.4.1-7.2 known ---- mq-config-gf 4.4.2-2.7 installed ---- mq-config-gf (dev.glassfish.org) 4.4.2-2.7 known ---- mq-config-gf (release.glassfish.sun.com) 4.4.1-7.2 known u--- mq-core 4.4.2-2.7 installed ---- mq-core (dev.glassfish.org) 4.4.2-2.7 known ---- mq-core (release.glassfish.sun.com) 4.4.1-7.2 known u--- mq-docs (dev.glassfish.org) 4.4.2-2.7 known ---- mq-docs 4.4.1-7.2 known u--- mq-docs (release.glassfish.sun.com) 4.4.1-7.2 known u--- mq-locale (dev.glassfish.org) 4.4.2-2.7 known ---- mq-locale 4.4.1-7.2 known u--- mq-locale (release.glassfish.sun.com) 4.4.1-7.2 known u--- mq-server 4.4.2-2.7 installed ---- mq-server (dev.glassfish.org) 4.4.2-2.7 known ---- mq-server (release.glassfish.sun.com) 4.4.1-7.2 known u--- ... sdk-branding-full (release.glassfish.sun.com) 3.0-74.2 known ---- sdk-branding-web (release.glassfish.sun.com) 3.0-74.2 known ---- sun-javaee-engine (dev.glassfish.org) 3.0.1-15 known ---- sun-javaee-engine 3.0-74.2 known u--- updatetool 2.3.0-38.2493 known ---- updatetool (dev.glassfish.org) 2.3.0-38.2493 known ---- updatetool (release.glassfish.sun.com) 2.3.0-38.2493 known ---- wxpython2.8-minimal 2.8.10.1-38.2493 known ---- wxpython2.8-minimal (dev.glassfish.org) 2.8.10.1-38.2493 known ---- wxpython2.8-minimal (release.glassfish.sun.com) 2.8.10.1-38.2493 known ---- wxpython2.8-minimal 2.8.7.1-8.724 known ----
Install a package from the available packages list.
pkg install package-name |
For example:
pkg install javadb |
The most recent version of the component is installed and information similar to the following is displayed:
DOWNLOAD PKGS FILES XFER (MB) javadb 0/1 61/200 2.10/7.26 PHASE ACTIONS Install Phase 222/222
To apply your changes, restart GlassFish Server.
See To Restart a Domain.
For the full syntax and options of the pkg command, see the pkg(1) man page. This man page is installed only after the pkg utilities have been fully installed.
To view this man page on UNIX and Linux systems, type the following command in a terminal window:
man -M as-install-parent/pkg/man/ pkg
To view this man page on Windows systems, use the type command to view the file as-install-parent\pkg\man\cat1\pkg.1.
This section provides the following instructions for updating GlassFish Server components after they have been installed:
When you install an updated version of a component, only those files that have been modified are downloaded and installed. Files that have been removed in the updated package are removed during the update process.
Stop GlassFish Server.
See To Stop a Domain.
To ensure that the pkg command can locate the application image, change to the base installation directory for GlassFish Server.
cd as-install |
The base installation directory for GlassFish Server.
Obtain a list of only the installed packages that have available updates:
pkg list -u |
Information similar to the following is displayed:
NAME (AUTHORITY) VERSION STATE UFIX glassfish-ejb 3.0.1-14 installed u--- glassfish-hk2 3.0.1-14 installed u--- glassfish-jca 3.0.1-14 installed u--- glassfish-jcdi 3.0.1-14 installed u--- glassfish-web 3.0.1-14 installed u--- glassfish-web-incorporation 3.0.1-14 installed u--- glassfish-web-profile 3.0.1-14 installed u--- jersey 1.1.5-1.0 installed u--- metro 2.0-29 installed u---
Install a new version of a package.
pkg install package-name |
For example:
pkg install metro |
Information similar to the following is displayed:
DOWNLOAD PKGS FILES XFER (MB) Completed 1/1 5/5 0.49/0.49 PHASE ACTIONS Removal Phase 2/2 Update Phase 7/7 Install Phase 2/2
Start GlassFish Server.
See To Start a Domain.
For the full syntax and options of the pkg command, see the pkg(1) man page. This man page is installed only after the pkg utilities have been fully installed.
To view this man page on UNIX and Linux systems, type the following command in a terminal window:
man -M as-install-parent/pkg/man/ pkg
To view this man page on Windows systems, use the type command to view the file as-install-parent\pkg\man\cat1\pkg.1.
GlassFish Server enables you to maintain multiple installation images on a single system. When you update an installation image, all the components that are present in that image are updated to new versions, if new versions are available. When you install updated versions of components, only those files that have been modified are downloaded and installed. Files that have been removed in the updated package are removed during the update process.
Stop GlassFish Server.
See To Stop a Domain.
To ensure that the pkg command can locate the application image, change to the base installation directory for GlassFish Server.
cd as-install |
The base installation directory for GlassFish Server.
Install all packages for the image.
pkg image-update |
Information similar to the following is displayed:
DOWNLOAD PKGS FILES XFER (MB) Completed 6/6 729/729 21.59/21.59 PHASE ACTIONS Removal Phase 887/887 Update Phase 253/253 Install Phase 584/584
Start GlassFish Server.
See To Start a Domain.
For the full syntax and options of the pkg command, see the pkg(1) man page. This man page is installed only after the pkg utilities have been fully installed.
To view this man page on UNIX and Linux systems, type the following command in a terminal window:
man -M as-install-parent/pkg/man/ pkg
To view this man page on Windows systems, use the type command to view the file as-install-parent\pkg\man\cat1\pkg.1.
If you are discontinuing use of a component and want to remove it from your system, you can do this by using the uninstall command. If you need to revert to a prior version of a component, you will need to uninstall the current version and install the prior version by specifying the version number.
Stop GlassFish Server.
See To Stop a Domain.
To ensure that the pkg command can locate the application image, change to the base installation directory for GlassFish Server.
cd as-install |
The base installation directory for GlassFish Server.
Obtain a list of all your installed components.
pkg list |
NAME (PUBLISHER) VERSION STATE UFIX felix 2.0.2-0 installed u--- glassfish-appclient 3.0.1-14 installed u--- glassfish-cmp 3.0.1-14 installed u--- glassfish-common 3.0.1-14 installed u--- glassfish-common-full 3.0.1-14 installed u--- glassfish-corba 3.0.0-41 installed u--- glassfish-corba-base 3.0.0-41 installed u--- glassfish-ejb 3.0.1-14 installed u--- glassfish-ejb-lite 3.0.1-14 installed u--- glassfish-full-incorporation 3.0.1-14 installed u--- glassfish-full-profile 3.0.1-14 installed u--- glassfish-grizzly 1.9.18-9 installed u--- glassfish-grizzly-full 1.9.18-9 installed u--- glassfish-gui 3.0.1-14 installed u--- glassfish-hk2 3.0.1-14 installed u--- glassfish-javahelp 2.0.2-0 installed u--- glassfish-jca 3.0.1-14 installed u--- glassfish-jcdi 3.0.1-14 installed u--- glassfish-jdbc 3.0.1-14 installed u--- glassfish-jms 3.0.1-14 installed u--- glassfish-jpa 3.0.1-14 installed u--- glassfish-jsf 2.0.2-10 installed u--- glassfish-jta 3.0.1-14 installed u--- glassfish-jts 3.0.1-14 installed u--- glassfish-management 3.0.1-14 installed u--- glassfish-nucleus 3.0.1-14 installed u--- glassfish-registration 3.0.1-14 installed u--- glassfish-scripting 3.0.1-14 installed u--- glassfish-upgrade 3.0.1-14 installed u--- glassfish-web 3.0.1-14 installed u--- glassfish-web-incorporation 3.0.1-14 installed u--- glassfish-web-profile 3.0.1-14 installed u--- javadb-client 10.5.3.0-1 installed ---- javadb-common 10.5.3.0-1 installed ---- javadb-core 10.5.3.0-1 installed ---- jersey 1.1.5-1.0 installed u--- metro 2.0-29 installed u--- mq-bin-exe 4.4.2-2.7 installed ---- mq-bin-sh 4.4.2-2.7 installed ---- mq-config-gf 4.4.2-2.7 installed ---- mq-core 4.4.2-2.7 installed ---- mq-server 4.4.2-2.7 installed ---- pkg 1.122.2-38.2493 installed ---- pkg-java 1.122-38.2493 installed ---- pkg-toolkit-incorporation 2.3.0-38.2493 installed ---- python2.4-minimal 2.4.4.0-38.2493 installed ----
Uninstall the component that you want to remove from your system.
pkg uninstall package-name |
For example:
pkg uninstall jruby |
Start GlassFish Server.
See To Restart a Domain.
For the full syntax and options of the pkg command, see the pkg(1) man page. This man page is installed only after the pkg utilities have been fully installed.
To view this man page on UNIX and Linux systems, type the following command in a terminal window:
man -M as-install-parent/pkg/man/ pkg
To view this man page on Windows systems, use the type command to view the file as-install-parent\pkg\man\cat1\pkg.1.
If there is a malfunction in an installed component, you might want to revert to an older version of that component. The way to restore an older version of a component is to first uninstall the current version of the component, then install the specific older version that you want to reinstate.
Be sure to verify that the older version of the component is in the repository before you uninstall your current version.
Stop GlassFish Server.
See To Stop a Domain.
To ensure that the pkg command can locate the application image, change to the base installation directory for GlassFish Server.
cd as-install |
The base installation directory for GlassFish Server.
Verify that the older version of the component is still available:
pkg list -fa pkg-name |
For example:
pkg list -fa jersey NAME (PUBLISHER) VERSION STATE UFIX jersey 1.1.5-1.0 installed ---- jersey 1.1.4.1-1.0 known u--- jersey 1.1.4.1-1.0 known u--- jersey 1.1.4.1-1.0 known u--- |
Obtain a list of your installed components:
pkg list |
Uninstall the currently-installed component that you want to replace.
pkg uninstall package-name |
For example:
pkg uninstall jersey |
Install the older version of the component.
pkg install package-name@version |
For example:
pkg install jersey@0.7-0.2 |
Verify that the older version is installed:
pkg list |
Start GlassFish Server.
See To Start a Domain.
For the full syntax and options of the pkg command, see the pkg(1) man page. This man page is installed only after the pkg utilities have been fully installed.
To view this man page on UNIX and Linux systems, type the following command in a terminal window:
man -M as-install-parent/pkg/man/ pkg
To view this man page on Windows systems, use the type command to view the file as-install-parent\pkg\man\cat1\pkg.1.
Oracle provides software support only for Oracle GlassFish Server, not for GlassFish Server Open Source Edition. Additionally, some features of Oracle GlassFish Server are not available in GlassFish Server Open Source Edition.
If you are using GlassFish Server Open Source Edition, you can upgrade to Oracle GlassFish Server by purchasing a right-to-use and installing the add-on component for upgrading GlassFish Server Open Source Edition. To obtain this component, and to ensure the reliability of your upgraded installation, you must configure your GlassFish Server installation to obtain updates from the appropriate repositories.
To use Oracle GlassFish Server in production after the upgrade, you must obtain a right to use this software from Oracle.
You can upgrade to Oracle GlassFish Server by using either Update Tool or the pkg command.
The procedure explains how to use Update Tool to obtain and install the add-on component for upgrading GlassFish Server Open Source Edition to Oracle GlassFish Server. For general instructions for using Update Tool, see the Update Tool online help.
Ensure that GlassFish Server Open Source Edition 3.0.1 is installed on your machine.
Start Update Tool.
as-install-parent/bin/updatetool |
From the Application Images list, select GlassFish Server Open Source Edition.
Click Edit Properties.
The Image Properties window opens.
(Optional) In the Image Properties window, change image title to Oracle GlassFish Server.
Remove the following publishers from the list of software sources for the image:
dev.glassfish.org
stable.glassfish.org
release.javaeesdk.sun.com
Remove each publisher as follows:
Add repositories for Oracle GlassFish Server to the application image.
Add each repository as follows:
In the Image Properties window, click Add.
The Publisher Properties window opens.
In the Publisher Properties window, specify the properties of the repository that you are adding and click OK.
The properties to specify for each repository are listed in the following table.
Publisher Name |
Repository URL |
---|---|
release.glassfish.sun.com |
http://pkg.sun.com/glassfish/v3/release/ |
dev.glassfish.sun.com |
http://pkg.sun.com/glassfish/v3/dev/ |
For more information about these repositories, see Oracle GlassFish Server Repositories.
The Publisher Properties window closes. The publisher is added to the Software Sources list in the Image Properties window.
In the Image Properties window, set the Preferred option for the release.glassfish.sun.com publisher and click OK.
The Image Properties window closes.
Under GlassFish Server Open Source Edition in the Available Images list, select Available Add-ons.
Select the add-on component for upgrading the distribution of GlassFish Server Open Source Edition that is installed:
Click Install.
To apply your changes, restart GlassFish Server.
See To Restart a Domain.
Ensure that GlassFish Server Open Source Edition 3.0.1 is installed on your machine.
To ensure that the pkg command can locate the application image, change to the base installation directory for GlassFish Server.
cd as-install |
The base installation directory for GlassFish Server.
Remove the following publishers from the list of publishers for the image:
dev.glassfish.org
stable.glassfish.org
release.javaeesdk.sun.com
pkg unset-publisher dev.glassfish.org stable.glassfish.org \ release.javaeesdk.sun.com |
Add repositories for Oracle GlassFish Server to the application image.
The properties to specify for each repository are listed in the following table.
Publisher Name |
Origin Uniform Resource Indentifier (URI) |
---|---|
release.glassfish.sun.com |
http://pkg.sun.com/glassfish/v3/release/ |
dev.glassfish.sun.com |
http://pkg.sun.com/glassfish/v3/dev/ |
The publisher release.glassfish.sun.com must be the preferred publisher.
For more information about these repositories, see Oracle GlassFish Server Repositories.
Add the repository whose publisher is release.glassfish.sun.com, which must be the preferred publisher.
pkg set-publisher -P -O http://pkg.sun.com/glassfish/v3/release/ \ release.glassfish.sun.com |
Add the repository whose publisher is dev.glassfish.sun.com.
pkg set-publisher -O http://pkg.sun.com/glassfish/v3/dev/ \ dev.glassfish.sun.com |
Install the add-on component for upgrading the distribution of GlassFish Server Open Source Edition that is installed:
If the Web Profile distribution is installed, install the Oracle GlassFish Server Web Profile add-on component.
pkg install glassfish-enterprise-web-profile |
If the Full Platform distribution is installed, install the Oracle GlassFish Server Full Platform add-on component.
pkg install glassfish-enterprise-full-profile |
To apply your changes, restart GlassFish Server.
See To Restart a Domain.
For the full syntax and options of the pkg command, see the pkg(1) man page. This man page is installed only after the pkg utilities have been fully installed.
To view this man page on UNIX and Linux systems, type the following command in a terminal window:
man -M as-install-parent/pkg/man/ pkg
To view this man page on Windows systems, use the type command to view the file as-install-parent\pkg\man\cat1\pkg.1.
GlassFish Server might be installed on a machine without an Internet connection. For example, for security reasons, GlassFish Server might be installed behind a restrictive firewall, or it might be installed on a LAN that is physically isolated from other networks. In such situations, neither the graphical Update Tool nor the pkg command-line utility that are included with GlassFish Server can contact a public repository server to download and install updates. Therefore, a local repository server must be configured inside the closed network and the GlassFish Server updates installed from there.
The following topics are addressed here:
Installing the Pre-Installed Toolkit Image inside a closed network
The Pre-Installed Toolkit Image provides the software components that are required to run a local repository server inside a closed network.
Configuring and running a local repository server on a locally accessible host
A local repository server makes it possible for a GlassFish Server installation to obtain packages and updates from inside a closed network rather than from the default public repository servers.
Configuring a GlassFish Server installation to obtain updates from the local repository server
Each GlassFish Server installation that will be updated inside a closed network must be configured to use a local repository server instead of the default public repository servers.
Installing the GlassFish Server updates
The GlassFish Server updates inside the closed network are performed normally, but use the local repository server instead of the public repository servers.
The Pre-Installed Toolkit Image provides the software components that are required to configure and run a local repository server inside a closed network. Running a local repository server makes it possible for a GlassFish Server installation to obtain packages and updates from within the closed network rather than from the default public GlassFish Server repositories.
The first three steps of this procedure require access to a machine that is connected to the Internet. This machine must also be able to write to some type of removable medium, such as CD, DVD, USB drive, or flash memory card.
The remaining steps in the procedure are performed on the machines that are inside the closed network, and do not require access to an Internet connection.
In a Web browser on the machine that is connected to the Internet, open the Pre-installed Toolkit Images and Starter Repositories page.
Download the ZIP file that contains the Pre-Installed Toolkit Image that is correct for your server's operating system and save it to the location of your choice.
The ZIP files are named according to operating system and architecture, using the following format:
pkg-toolkit-2.3.2-platform-arch.zip |
For example, the ZIP file for 32–bit Linux operating systems is named:
pkg-toolkit-2.3.2-linux-i386.zip |
Download the correct ZIP file for the operating system and architecture on each of the following machines:
The machine on which the local repository server will be run
Each machine on which one or more GlassFish Server installations will be updated inside the closed network
Copy each Pre-Installed Toolkit Image ZIP file to a removable medium that you can physically transport to the machines inside the closed network.
Copy the correct Pre-Installed Toolkit Image ZIP file for each operating system from the removable medium to the directories of your choice on the following machines:
The machine on which the local repository server will be run
Each machine on which one or more GlassFish Server installations will be updated inside the closed network
Unzip the Pre-Installed Toolkit Image ZIP file on each machine to which you copied the ZIP file in the preceding step.
The size of the expanded Pre-Installed Toolkit Image ZIP file depends on the operating system:
On Windows systems, the expanded ZIP file is approximately 11 Mbytes.
On Linux and Solaris systems, the expanded ZIP file is approximately 13 Mbytes.
(Optional) On each machine to which you copied the Pre-Installed Toolkit Image, verify that the pkg command-line tool is correctly installed.
Change to the pkg/bin subdirectory of the directory that contains the unzipped Pre-Installed Toolkit Image.
cd toolkit-dir/pkg/bin |
The directory that contains the unzipped Pre-Installed Toolkit Image.
Display the pkg version.
./pkg version |
Output similar to the following is displayed:
1.122.2-38.2791 |
A local repository server makes it possible for a GlassFish Server installation to obtain packages and updates from within a closed network, rather than from the default public repository servers.
Ensure that the following conditions are met:
You have access to a machine that is connected to the Internet.
The machine that is connected to the Internet can write to some type of removable medium, such as CD, DVD, USB drive, or flash memory card.
The Pre-Installed Toolkit Image has been installed as described in To Install the Pre-Installed Toolkit Image Inside a Closed Network.
In a Web browser on the machine that is connected to the Internet, download the ZIP file that contains the GlassFish Server repository for the operating system on which GlassFish Server is running.
The repository ZIP files for GlassFish Server are distributed as patches through the SunSolve Web site.
Log in to the SunSolve site.
Navigate to the Patch Finder page.
Enter the desired patch number in the Patch ID field and then click Search.
Operating System |
Patch ID |
---|---|
sunos-sparc |
145091 |
sunos-i386 |
145092 |
linux-i386 |
145093 |
windows-i386 |
145094 |
mac-universal |
145095 |
A list of patches appears at the bottom of the page.
Download the ZIP file for the latest version of the desired patch.
Copy each ZIP file that you downloaded from SunSolve onto a removable medium that you can physically transport to the local repository server.
Each SunSolve ZIP file is approximately 270 Mbytes in size.
Copy each SunSolve ZIP file from the removable medium to the local repository server machine.
The directory used for the SunSolve ZIP files should be different than the directory in which the Pre-Installed Toolkit Image was copied, as described in To Install the Pre-Installed Toolkit Image Inside a Closed Network.
Unzip each SunSolve ZIP file that you copied in the preceding step.
The SunSolve ZIP files are wrappers that contain a GlassFish Server repository ZIP file, a README file, and a license file. For example, the SunSolve ZIP file for Linux contains the following files:
LEGAL_LICENSE.TXT README.145093-01 ogs-3.0.1-repo-linux-i386.zip |
In this example, the GlassFish Server repository ZIP file is named ogs-3.0.1-repo-linux-i386.zip.
On the local repository server machine, start the repository server daemon.
Change to the Pre-Installed Toolkit Image pkg/bin directory.
cd toolkit-dir/pkg/bin |
The directory that contains the unzipped Pre-Installed Toolkit Image.
Start the pkg.depotd daemon.
./pkg.depotd -d repository-dir -p port |
The directory that contains the unzipped GlassFish Server repository.
Your choice of port number for requests to the repository server. The default is 80.
Several startup messages are displayed as the repository daemon initializes, as shown in the following example.
This example starts the pkg.depotd daemon using the following parameters:
The name of the Pre-Installed Toolkit Image directory.
The GlassFish Server repository directory.
The port number used by the local repository daemon.
./pkg.depotd -d /opt/145093-01/linux-i386/ -p 30000 [ Jun 15 08:06:38 ] ENGINE Listening for SIGHUP. [ Jun 15 08:06:38 ] ENGINE Listening for SIGTERM. [ Jun 15 08:06:38 ] ENGINE Listening for SIGUSR1. [ Jun 15 08:06:38 ] ENGINE Bus STARTING [ Jun 15 08:06:38 ] ENGINE Started monitor thread '_TimeoutMonitor'. [ Jun 15 08:06:38 ] ENGINE Serving on 0.0.0.0:30000 [ Jun 15 08:06:38 ] ENGINE Bus STARTED |
Each GlassFish Server installation that will be updated inside a closed network must be configured to use a local repository server instead of the default public repository servers.
This procedure must be completed on each GlassFish Server installation on which updates will be performed inside the closed network.
Ensure that the following conditions are met:
The Pre-Installed Toolkit Image is installed on each machine on which one or more GlassFish Server installations will be upgraded, as described in To Install the Pre-Installed Toolkit Image Inside a Closed Network
The local repository server is configured, as described in To Configure a Local Repository Server Inside a Closed Network
Set the http_proxy environment variable for the local repository server, if necessary.
This step is required if a proxy is needed to access the local repository from within the closed network.
export http_proxy=proxy-host:port |
The fully qualified URL for the proxy host.
The port on which the proxy-host listens.
Change to the GlassFish Server installation directory.
cd as-install |
The path to the directory that contains the GlassFish Server installation that is to be updated.
The remainder of this procedure must be performed from within the GlassFish Server installation directory.
Use the pkg command in the Pre-Installed Image Toolkit installation directory to tell the GlassFish Server installation to use the local repository server.
toolkit-dir/pkg/bin/pkg -R as-install set-publisher -Pe -O http://repo-host:port publisher |
The directory that contains the unzipped Pre-Installed Toolkit Image.
The path to the directory that contains the GlassFish Server installation that is to be updated.
The name of the server on which the pkg.depotd repository server daemon is running.
The port used for the pkg.depotd daemon, as specified in To Configure a Local Repository Server Inside a Closed Network.
The name of the preconfigured GlassFish Server publisher. For GlassFish Server, use release.glassfish.sun.com as the publisher.
(Optional) Verify that the local GlassFish Server repository is configured correctly.
toolkit-dir/pkg/bin/pkg publisher |
The name of the of the local server repository and publisher should be listed, as shown in the following example.
This example configures a GlassFish Server installation to use a local repository server. The following parameters are used:
The GlassFish Server installation directory.
The Pre-Installed Toolkit Image directory.
The host name of the local repository server.
The port number used by the repository server.
/opt/toolkit/pkg/bin/pkg -R /opt/glassfish set-publisher -P --enable \ -O http://repohost:30000 release.glassfish.sun.com # /opt/toolkit/pkg/bin/pkg publisher PUBLISHER TYPE STATUS URI release.glassfish.sun.com (preferred) origin online http://repohost:30000/ |
After configuring a GlassFish Server installation to use a local repository server, as described in the previous procedures in this section, GlassFish Server updates inside a closed network are performed normally. The only difference is that the GlassFish Server installation being updated inside the closed network will use a local repository server instead of the public repository servers.
Perform the following procedure on each GlassFish Server installation that will be updated.
Ensure that each GlassFish Server installation that will be updated is configured to use the local repository server, as described in To Configure a GlassFish Server Installation to Use a Local Repository Server Inside a Closed Network.
Stop GlassFish Server.
See To Stop a Domain.
Change to the GlassFish Server installation directory.
cd as-install |
The remainder of this procedure must be performed from within the GlassFish Server installation directory.
Use either the graphical Update Tool or the pkg command-line utility to perform the desired updates.
For detailed instructions on updating or installing GlassFish Server components, see Updating Installed Components.
Start GlassFish Server.
See To Restart a Domain.