Updating bundles that contain common libraries

OSGi bundles that contain common libraries for use by other OSGi bundles must be updated in a specific order.

Before you begin

An updated CICS® bundle that contains the new version of the OSGi bundle must be present in zFS. If you manage common libraries in a separate CICS bundle, you can manage the lifecycle of these libraries separately from the applications that depend on them.

About this task

Typically, an OSGi bundle specifies a range of supported versions in a dependency on another OSGi bundle. Using a range provides more flexibility to make compatible changes in the framework. When you are updating bundles that contain common libraries, the version number of the OSGi bundle increases. However, the running applications are already using a version of the bundle that satisfies the dependencies. To obtain the most recent version of the library, you must refresh the OSGi bundles for the applications. It is therefore possible to update specific applications to use different versions of the library, and leave other applications to run on an older version.

When you update an OSGi bundle that contains common libraries, you can completely replace the CICS BUNDLE resource. However, if classes are not loaded in the library, the dependent bundles might receive errors. Alternatively, you can install a new version of the library and run it in the framework alongside the original version. If the OSGi bundles have different version numbers, the OSGi framework can run both bundles concurrently.

Procedure

To replace an existing OSGi bundle in an OSGi JVM server:

  1. Define and install a CICS BUNDLE resource that points to the new version of the CICS bundle, which contains the OSGi bundle that defines the common libraries. CICS defines the new version of the OSGi bundle in the OSGi framework. The existing OSGi bundles continue to use the previous version of the library.
  2. Check the status of the OSGi bundles in the OSGi Bundles view in CICS Explorer® (Operations > Java > OSGi Bundles). The list shows two entries for the same OSGi bundle symbolic name with different versions that are running in the framework.
  3. To obtain the new version of the library in a dependent Java™ application, use one of the following methods:
    • Replace the CICS bundle for the Java application.
      1. Disable and discard the CICS BUNDLE resource for the Java application.
      2. Reinstall the CICS BUNDLE resource for the Java application.
    • Phase in a new version of the Java application.
      1. Ask the Java developer to update the version information for the OSGi bundle. The new version of the OSGi bundle must have a higher version specified in the OSGi bundle manifest and be within the version range specified when the OSGi bundle project was added to the CICS bundle. Optionally, the new version of the OSGi bundle could also have its dependencies modified to specifically require the new version of the OSGi bundle that defines the common libraries.
      2. Copy the JAR for the new version of OSGi bundle to the root directory of the CICS BUNDLE resource.
      3. In the Operations > Bundles view in CICS Explorer, right-click the CICS bundle that contains the OSGi bundle, click Phase In, then click OK to phase in the new version of the OSGi bundle.
    When the OSGi bundle is loaded in the framework, it obtains the latest version of the common libraries.
  4. Check the status of the CICS BUNDLE resource in the Bundles view in CICS Explorer (Operations > Bundles).

Results

You have updated an OSGi bundle that contains common libraries and updated a Java application to use the latest version of the libraries.