18/29

# 11 Extending and Updating GlassFish Server

This chapter explains how to extend and update a deployed Oracle GlassFish Server 3.1.2 installation.

The following topics are addressed here:

- About Add-On Components

- Preconfigured Repositories for GlassFish Server

- Tools for Extending and Updating GlassFish Server

- Adding Components

- Updating Installed Components

- Removing Installed Components

- Upgrading to Oracle GlassFish Server From GlassFish Server Open Source Edition

- Extending and Updating GlassFish Server Inside a Closed Network

## About Add-On Components

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.

## Preconfigured Repositories for GlassFish Server

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:

- Oracle GlassFish Server Repositories

- GlassFish Server Open Source Edition Repositories

### Oracle GlassFish Server Repositories

Table 11-1 lists the preconfigured repositories for Oracle GlassFish Server.

Table 11-1 Oracle GlassFish Server Preconfigured Repositories

Publisher | URL | Description
--- | --- | ---
`release.glassfish.oracle.com` | `pkg.oracle.com/glassfish/v3/release/` | Commercial, production quality versions of the core components and add-on components of Oracle GlassFish Server
`contrib.glassfish.oracle.com` | `pkg.oracle.com/glassfish/v3/contrib/` | Additional add-on components that are contributed by Oracle partners
`contrib.glassfish.org` | `pkg.glassfish.org/v3/contrib/` | Additional add-on components that are contributed by the GlassFish community
`dev.glassfish.oracle.com` | `pkg.oracle.com/glassfish/v3/dev/` | Developmental, beta, and prerelease versions of the components in the `pkg.oracle.com/glassfish/v3/release/` repository

For Oracle GlassFish Server installations, the `release.glassfish.oracle.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 change the preferred publisher's repository URL from the Oracle GlassFish Server release repository to the Oracle GlassFish Server support repository. For more information, see Enabling the Oracle GlassFish Server Support Repository.

#### Enabling the Oracle GlassFish Server Support Repository

If you have support for Oracle GlassFish Server, you can change the repository URL for the preferred provider, `release.glassfish.oracle.com`, to refer to the support repository instead of to the release repository. This support repository includes the content provided by the release repository, but also includes commercial, production quality updates that resolve issues reported by Oracle GlassFish Server customers.

Enabling the Oracle GlassFish Server support repository involves two tasks:

1. Your company's technical contact acquires the key and certificate files needed to access the support repository.

2. GlassFish Server administrators use the key and certificate files to change the `release.glassfish.oracle.com` publisher's repository URL to the support repository.

Note:

The key and certificate files needed to enable access to the support repository expire. When they expire, you need to acquire new ones and apply them to your Oracle GlassFish Server installations.

##### To Acquire the Key and Certificate Files for the Support Repository

To acquire the key and certificate files for the Oracle GlassFish Server support repository, your company's technical contact uses the pkg-register.oracle.com Certificate Generator.

Before You Begin

Before using the Certificate Generator, you must add your Oracle GlassFish Server Customer Support Identification (CSI) numbers to your My Oracle Support account. If you do not yet have a My Oracle Support account, you can create one at `https://support.oracle.com`.

1. In a web browser, go to `https://pkg-register.oracle.com` and sign in using your My Oracle Support account information.

   After signing in, the Certificate Requests page displays, showing "Oracle GlassFish Server 3 Support" as one of the products for which you can request a certificate.

2. Select "Oracle GlassFish Server 3 Support" and then click Submit.

   The Certificate Requests: Additional Information page displays.

3. Enter an optional comment if desired, and then click Submit.

   The Certificate Information page displays.

4. Note down the expiration date of the certificate.

   When the current certificate expires, you will need to repeat this process to acquire new certificates.

5. Click Download Key and save the `Oracle_GlassFish_Server_3_Support.key.pem` file.

6. Click Download Certificate and save the `Oracle_GlassFish_Server_3_Support.certificate.pem` file.

7. Sign out of the Certificate Generator site.

8. Make the key and certificate files you saved available to your company's Oracle GlassFish Server administrators.

   Note:

   If you accidentally delete or misplace these files, you can sign into `https://pkg-register.oracle.com` using your My Oracle Support account information and get replacement copies of them.

##### To Change the `release.glassfish.oracle.com` Publisher's URL to the Support Repository

Use the `pkg` utility to change the repository URL for the `release.glassfish.oracle.com` publisher to the Oracle GlassFish Server support repository for an Oracle GlassFish Server installation.

Before You Begin

Before you use the `pkg` utility, you must copy the `Oracle_GlassFish_Server_3_Support.key.pem` key file and the `Oracle_GlassFish_Server_3_Support.certificate.pem` certificate file to a location accessible from the host where Oracle GlassFish Server is installed.

1. On the host where Oracle GlassFish Server is installed, navigate to the parent installation directory:

       cd as-install-parent

   The default parent installation directory is `glassfish3`.

2. Use the `pkg set-publisher` command to change the repository URL:

   - On Unix systems (including Mac OS), where backslash (`\`) is the command line continuation character:

         bin/pkg set-publisher -P \
         -k path-to-key-file/Oracle_GlassFish_Server_3_Support.key.pem \
         -c path-to-certificate-file/Oracle_GlassFish_Server_3_Support.certificate.pem \
         -O https://pkg.oracle.com/glassfish/v3/support release.glassfish.oracle.com

   - On Windows systems, where caret (`^`) is the command line continuation character:

         bin\pkg set-publisher -P ^
         -k path-to-key-file\Oracle_GlassFish_Server_3_Support.key.pem ^
         -c path-to-certificate-file\Oracle_GlassFish_Server_3_Support.certificate.pem ^
         -O https://pkg.oracle.com/glassfish/v3/support release.glassfish.oracle.com

### GlassFish Server Open Source Edition Repositories

Table 11-2 lists the preconfigured repositories for GlassFish Server Open Source Edition.

Table 11-2 GlassFish Server Open Source Edition Preconfigured Repositories

Publisher | URL | Description
--- | --- | ---
`release.javaeesdk.oracle.com` | `pkg.sun.com/javaeesdk/6/release/` | Production quality versions of the core components and add-on components of GlassFish Server Open Source Edition
`stable.glassfish.org` | `pkg.glassfish.org/v3/stable/` | Most current stable pre-release build of core and add-on components
`contrib.glassfish.oracle.com` | `pkg.sun.com/glassfish/v3/contrib/` | Additional add-on components that are contributed by Oracle partners
`contrib.glassfish.org` | `pkg.glassfish.org/v3/contrib/` | Additional add-on components that are contributed by the GlassFish community
`dev.glassfish.org` | `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.

## Tools for Extending and Updating GlassFish Server

GlassFish Server provides the following tools for updating software on a deployed server:

- Update Tool

- The `pkg` Command

- Administration Console

### Update Tool

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:

- Multi-platform Packaging for Layered Distros

- Toolkit Documentation

### The `pkg` Command

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 Server in the as-install-parent`/pkg/man` directory.

### Administration Console

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.

Note:

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.

When the Administration Console starts, it automatically checks the package repositories for updates to installed components. In situations where the GlassFish Server host does not have access to the package repositories, you can disable this automatic check by setting a JVM option:

    asadmin> create-jvm-options -Dcom.sun.enterprise.tools.admingui.NO_NETWORK=true

After setting this JVM option, restart the domain.

## Adding Components

This section provides instructions for using the `pkg` command to install GlassFish Server add-on components on your deployed GlassFish Server.

### To Install an Add-on Component

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,

Note:

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.

Before You Begin

GlassFish Server 3.1.2 must be fully deployed before you can install additional components. If you need installation instructions, see the Oracle GlassFish Server Installation Guide.

1. To ensure that the `pkg` command can locate the application image, change to the base installation directory for GlassFish Server.

       cd as-install

   The as-install is the base installation directory for GlassFish Server.

2. 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  ----

3. 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.oracle.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.oracle.com) 3.0-74.2        known      u---
       glassfish-branding (release.glassfish.oracle.com) 3.0-74.2        known      ----
       glassfish-branding-gui (release.glassfish.oracle.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.oracle.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.oracle.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.oracle.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.oracle.com)         4.4.1-7.2       known      u---
       mq-branding (release.glassfish.oracle.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.oracle.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.oracle.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.oracle.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.oracle.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.oracle.com)         4.4.1-7.2       known      u---
       ...
       sdk-branding-full (release.glassfish.oracle.com) 3.0-74.2        known      ----
       sdk-branding-web (release.glassfish.oracle.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.oracle.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.oracle.com) 2.8.10.1-38.2493 known      ----
       wxpython2.8-minimal                           2.8.7.1-8.724   known      ----

4. 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

5. To apply your changes, restart GlassFish Server.

   See To Restart a Domain.

See Also

For the full syntax and options of the `pkg` command, see the `pkg` 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`.

## Updating Installed Components

This section provides the following instructions for updating GlassFish Server components after they have been installed:

- To Update an Installed Component

- To Update All Installed Components in an Image

### To Update an Installed Component

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.

1. Stop GlassFish Server.

   See To Stop a Domain.

2. To ensure that the `pkg` command can locate the application image, change to the base installation directory for GlassFish Server.

       cd as-install

   The as-install is the base installation directory for GlassFish Server.

3. 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---

4. 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

5. Start GlassFish Server.

   See To Start a Domain.

See Also

For the full syntax and options of the `pkg` command, see the `pkg` 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`.

### To Update All Installed Components in an Image

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.

1. Stop GlassFish Server.

   See To Stop a Domain.

2. To ensure that the `pkg` command can locate the application image, change to the base installation directory for GlassFish Server.

       cd as-install

   The as-install is the base installation directory for GlassFish Server.

3. 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

4. Start GlassFish Server.

   See To Start a Domain.

See Also

For the full syntax and options of the `pkg` command, see the `pkg` 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`.

## Removing Installed Components

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.

- To Uninstall an Installed Component

- To Uninstall and Revert to an Older Version of a Component

### To Uninstall an Installed Component

1. Stop GlassFish Server.

   See To Stop a Domain.

2. To ensure that the `pkg` command can locate the application image, change to the base installation directory for GlassFish Server.

       cd as-install

   The as-install is the base installation directory for GlassFish Server.

3. 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  ----

4. Uninstall the component that you want to remove from your system.

       pkg uninstall package-name

   For example:

       pkg uninstall python2.4-minimal

5. Start GlassFish Server.

   See To Restart a Domain.

See Also

For the full syntax and options of the `pkg` command, see the `pkg` 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`.

### To Uninstall and Revert to an Older Version of a Component

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.

Before You Begin

Be sure to verify that the older version of the component is in the repository before you uninstall your current version.

1. Stop GlassFish Server.

   See To Stop a Domain.

2. To ensure that the `pkg` command can locate the application image, change to the base installation directory for GlassFish Server.

       cd as-install

   The as-install is the base installation directory for GlassFish Server.

3. 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---

4. Obtain a list of your installed components:

       pkg list

5. Uninstall the currently-installed component that you want to replace.

       pkg uninstall package-name

   For example:

       pkg uninstall jersey

6. Install the older version of the component.

       pkg install package-name@version

   For example:

       pkg install jersey@0.7-0.2

7. Verify that the older version is installed:

       pkg list

8. Start GlassFish Server.

   See To Start a Domain.

See Also

For the full syntax and options of the `pkg` command, see the `pkg` 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`.

## Upgrading to Oracle GlassFish Server From GlassFish Server Open Source Edition

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 (`https://shop.oracle.com/pls/ostore/product?p1=OracleGlassFishServer`) 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.

Note:

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.

### To Upgrade to Oracle GlassFish Server by Using Update Tool

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.

Before You Begin

Ensure that GlassFish Server Open Source Edition 3.1.2 is installed on your machine.

1. Start Update Tool.

       as-install-parent/bin/updatetool

2. From the Application Images list, select GlassFish Server Open Source Edition.

3. Click Edit Properties.

   The Image Properties window opens.

4. In the Image Properties window, change image title to Oracle GlassFish Server.

5. Add repositories for Oracle GlassFish Server to the application image.

   Add each repository as follows:

   1. In the Image Properties window, click Add.

      The Publisher Properties window opens.

   2. 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.oracle.com` | `http://pkg.oracle.com/glassfish/v3/release/`
      `dev.glassfish.oracle.com` | `http://pkg.oracle.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.

6. In the Image Properties window, set the Preferred option for the `release.glassfish.oracle.com` publisher and click OK.

   The Image Properties window closes.

7. Remove the `stable.glassfish.org` publisher from the list of software sources for the image. Additionally, remove any of the following publishers that appear in the list:

   - `contrib.glassfish.oracle.com`

   - `contrib.glassfish.org`

   - `dev.glassfish.org`

   - `release.javaeesdk.oracle.com`

   Remove each publisher as follows:

   1. In the Image Properties window, select the publisher that you are removing.

   2. Click Remove.

8. Under GlassFish Server Open Source Edition in the Available Images list, select Available Add-ons.

9. Select the add-on component for upgrading the distribution of GlassFish Server Open Source Edition that is installed:

   - If the Web Profile distribution is installed, select the Oracle GlassFish Server Web Profile add-on component.

   - If the Full Platform distribution is installed, install the Oracle GlassFish Server Full Platform add-on component.

10. Click Install.

11. To apply your changes, restart GlassFish Server.

    See To Restart a Domain.

### To Upgrade to Oracle GlassFish Server by Using the `pkg` Command

Before You Begin

Ensure that GlassFish Server Open Source Edition 3.1.2 is installed on your machine.

1. To ensure that the `pkg` command can locate the application image, change to the base installation directory for GlassFish Server.

       cd as-install

   The as-install is the base installation directory for GlassFish Server.

2. Remove the following publishers from the list of publishers for the image:

   - `dev.glassfish.org`

   - `stable.glassfish.org`

   - `release.javaeesdk.oracle.com`

       pkg unset-publisher dev.glassfish.org stable.glassfish.org \
       release.javaeesdk.oracle.com

3. 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.oracle.com` | `http://pkg.oracle.com/glassfish/v3/release/`
   `dev.glassfish.oracle.com` | `http://pkg.oracle.com/glassfish/v3/dev/`

   The publisher `release.glassfish.oracle.com` must be the preferred publisher.

   For more information about these repositories, see Oracle GlassFish Server Repositories.

   1. Add the repository whose publisher is `release.glassfish.oracle.com`, which must be the preferred publisher.

          pkg set-publisher -P -O http://pkg.oracle.com/glassfish/v3/release/ \
          release.glassfish.oracle.com

   2. Add the repository whose publisher is `dev.glassfish.oracle.com`.

          pkg set-publisher -O http://pkg.oracle.com/glassfish/v3/dev/ \
          dev.glassfish.oracle.com

4. 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

5. To apply your changes, restart GlassFish Server.

   See To Restart a Domain.

See Also

For the full syntax and options of the `pkg` command, see the `pkg` 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`.

## Extending and Updating GlassFish Server Inside a Closed Network

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:

1. 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. See To Install the Pre-Installed Toolkit Image Inside a Closed Network.

2. 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. See To Configure a Local Repository Server Inside a Closed Network.

3. 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. See To Configure a GlassFish Server Installation to Use a Local Repository Server Inside a Closed Network.

4. 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. See To Install Updates From a Local Repository.

### To Install the Pre-Installed Toolkit Image Inside a Closed Network

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.

Before You Begin

- 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.

1. In a Web browser on the machine that is connected to the Internet, open the Pre-installed Toolkit Images and Starter Repositories page.

2. 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.3-platform-arch.zip

   For example, the ZIP file for 32-bit Linux operating systems is named:

       pkg-toolkit-2.3.3-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

3. Copy each Pre-Installed Toolkit Image ZIP file to a removable medium that you can physically transport to the machines inside the closed network.

4. 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

5. 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.

6. On each machine to which you copied the Pre-Installed Toolkit Image, verify that the `pkg` command-line tool is correctly installed.

   1. Change to the `pkg/bin` subdirectory of the directory that contains the unzipped Pre-Installed Toolkit Image.

          cd toolkit-dir/pkg/bin

      The toolkit-dir is the directory that contains the unzipped Pre-Installed Toolkit Image.

   2. Display the `pkg` version.

          ./pkg version

      Output similar to the following is displayed:

          1.122.2-38.2791

### To Configure a Local Repository Server Inside a Closed Network

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.

Before You Begin

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.

1. 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 My Oracle Support Web site.

   1. Log in to the My Oracle Support site.

   2. Click the Patches & Updates tab.

   3. Enter the desired patch number in the Patch Name or Number 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.

   4. Download the ZIP file for the latest version of the desired patch.

2. Copy each ZIP file that you downloaded from My Oracle Support onto a removable medium that you can physically transport to the local repository server.

   Each My Oracle Support ZIP file is approximately 270 Mbytes in size.

3. Copy each My Oracle Support ZIP file from the removable medium to the local repository server machine.

   The directory used for the My Oracle Support 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.

4. Unzip each My Oracle Support ZIP file that you copied in the preceding step.

   The My Oracle Support ZIP files are wrappers that contain a GlassFish Server repository ZIP file, a README file, and a license file. For example, the My Oracle Support 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`.

   1. Unzip the My Oracle Support ZIP file.

      For example:

          unzip 145093-01

   2. Change to the directory that was created when the My Oracle Support ZIP file was unzipped.

      For example:

          cd 145093-01

   3. Unzip the GlassFish Server repository ZIP file.

      For example:

          unzip ogs-3.0.1-repo-linux-i386.zip

5. On the local repository server machine, start the repository server daemon.

   1. Change to the Pre-Installed Toolkit Image `pkg/bin` directory.

          cd toolkit-dir/pkg/bin

      The toolkit-dir is the directory that contains the unzipped Pre-Installed Toolkit Image.

   2. Start the `pkg.depotd` daemon.

          ./pkg.depotd -d repository-dir -p port

      repository-dir

        The directory that contains the unzipped GlassFish Server repository.

      port

        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.

Example 11-1 Starting a Local Repository Daemon

This example starts the `pkg.depotd` daemon using the following parameters:

`/opt/toolkit`

  The name of the Pre-Installed Toolkit Image directory.

`/opt/145093-01/linux-i386/`

  The GlassFish Server repository directory.

30000

  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

### To Configure a GlassFish Server Installation to Use a Local Repository Server Inside a Closed Network

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.

Before You Begin

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

1. 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

   proxy-host

     The fully qualified URL for the proxy host.

   port

     The port on which the proxy-host listens.

2. Change to the GlassFish Server installation directory.

       cd as-install

   The as-install is the path to the directory that contains the GlassFish Server installation that is to be updated.

   Note:

   The remainder of this procedure must be performed from within the GlassFish Server installation directory.

3. 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

   toolkit-dir

     The directory that contains the unzipped Pre-Installed Toolkit Image.

   as-install

     The path to the directory that contains the GlassFish Server installation that is to be updated.

   repo-host

     The name of the server on which the `pkg.depotd` repository server daemon is running.

   port

     The port used for the `pkg.depotd` daemon, as specified in To Configure a Local Repository Server Inside a Closed Network.

   publisher

     The name of the preconfigured GlassFish Server publisher. For GlassFish Server, use `release.glassfish.oracle.com` as the publisher.

4. 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.

Example 11-2 Configuring the `pkg` Command to Use a Local Repository

This example configures a GlassFish Server installation to use a local repository server. The following parameters are used:

`/opt/glassfish`

  The GlassFish Server installation directory.

`/opt/toolkit`

  The Pre-Installed Toolkit Image directory.

`repohost`

  The host name of the local repository server.

30000

  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.oracle.com
    # /opt/toolkit/pkg/bin/pkg publisher
    PUBLISHER                             TYPE     STATUS   URI
    release.glassfish.oracle.com (preferred)  origin   online   http://repohost:30000/

### To Install Updates From a Local Repository

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.

Before You Begin

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.

1. Stop GlassFish Server.

   See To Stop a Domain.

2. Change to the GlassFish Server installation directory.

       cd as-install

   Note:

   The remainder of this procedure must be performed from within the GlassFish Server installation directory.

3. 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.

4. Start GlassFish Server.

   See To Restart a Domain.