Updating bundle versions in a deployed OSGi application

After you import your OSGi application as an asset, newer versions of the bundles or composite bundles that the asset uses might become available. You can update bundle and composite bundle versions, update the associated asset, then update the composition unit that includes the asset. When you save the changes to the composition unit, the associated business-level application is updated to use the new configuration.

Before you begin

After you import the enterprise bundle archive (EBA) file for your OSGi application as an asset, you can update versions of existing bundles but you cannot add extra bundles to the asset. However, after you have added the asset as a composition unit to a business-level application, you can extend the business-level application by adding one or more composite bundles to the composition unit. To update bundles and composite bundles that are specified in an EBA asset, use this task. To add or remove composite bundle extensions for a deployed application, see Extending a deployed OSGi application.

About this task

When you first create an OSGi application, each bundle and composite bundle in the application is either directly contained in the EBA file or pulled in by reference. After you import your application as an asset, you can no longer change the direct contents of the asset. To update bundles and composite bundles that are specified in an asset, you add the updated versions to a repository then apply the updates to the asset.

The asset is not updated automatically when new bundle versions become available; it is up to you to decide if and when to update the asset. Updating an asset to use a new bundle version might require bundle downloads. You cannot update an asset until bundle downloads are complete from any previous update.

Similarly, the composition unit that contains the asset is not updated automatically, and you do not have to update the composition unit every time you update the asset. The composition unit also contains configuration information for running the bundles in a business-level application, and when you make bundle changes to the asset you might also have to make configuration changes to the composition unit.

No changes are made to the business-level application until you update the composition unit to the latest deployment and save the changes. If the business-level application is running, the bundle and configuration updates are applied immediately.
For users who are moving from a previous version: In the WebSphere® Application Server Version 7 Feature Pack for OSGi Applications and Java™ Persistence API 2.0, bundle changes to the asset are applied by restarting the business-level application, rather than by updating the composition unit. The current approach means that many bundle changes can be applied in place, without restarting the running business-level application.

Procedure

  1. Create an updated version of a bundle or composite bundle that is specified in your EBA asset.
  2. Add the updated bundle or composite bundle to a bundle repository.

    An updated bundle or composite bundle is installed in a bundle repository then pulled into the asset by reference. Composite bundles, and bundles referenced by composite bundles, are installed in the internal bundle repository or in an external repository that can process composite bundles. See Administering bundle repositories.

  3. Check the bundle download status of the asset.

    This status is either Bundles downloading..., Bundle downloads are complete, or No bundles downloads are required. If the asset has previously been updated, the bundle downloads for the previous update must have completed.

  4. Update bundle or composite bundle versions for the asset.
  5. Optional: Check the update status of the composition unit.
    If you plan to update the composition unit at this time, check the update status of the associated OSGi composition unit. This status is one of the following values:
    • Using latest OSGi application deployment.
    • New OSGi application deployment not yet available because it requires bundles that are still downloading.
    • New OSGi application deployment available.
    • New OSGi application deployment cannot be applied because bundle downloads have failed.
  6. Optional: Update the composition unit to the latest deployment.

    If a new version of the EBA asset is available, and all bundle downloads are complete, you can update the OSGi composition unit so that the business-level application uses the newer configuration. You do not have to update the composition unit every time you update the asset or add a composite bundle extension.

    If any of the updates contain configuration options, you update the configuration information. You can also take the opportunity to make additional, non-essential configuration changes.

    When you save the changes to the composition unit, the associated business-level application is updated to use the new configuration. If the business-level application is running, the bundle and configuration updates are applied immediately.

    If possible (that is, depending on the nature of the updates) the system applies the updates without restarting the application. If you update a bundle that provides only OSGi services to the rest of the application, then only that bundle is restarted. If you update a bundle that provides one or more packages to other bundles, then those bundles and any bundles to which they provide packages are restarted. If, however, a new package or service dependency is added, or an existing package or service dependency is removed, then the application is restarted; a newly added package and service can come from a newly-provisioned bundle, or from a bundle that has already been provisioned.