Update bundle versions in a deployed OSGi application
After you import the 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.
After you import the enterprise bundle archive (EBA) file for the OSGi application as an asset, we can update versions of existing bundles but we cannot add extra bundles to the asset. However, after we have added the asset as a composition unit to a business-level application, we 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.
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 the application as an asset, we can no longer change the direct contents of the asset. To update bundles and composite bundles that are specified in an asset, we 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 containing the asset is not updated automatically, and we 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 we 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 WAS 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.
- Create an updated version of a bundle or composite bundle specified in the EBA asset.
See Develop an OSGi application and Develop a composite bundle.
- 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 Administer bundle repositories.
- 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.
- Update bundle or composite bundle versions for the asset.
Use either of the following methods:
- Update bundle versions for the asset using the administrative console.
- Update bundle versions for the asset using the editAsset command.
- Optional: Check the update status of the composition unit.
If we 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:
- Use 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.
- 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, we 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.
Use either of the following methods:
- Update the composition unit using the administrative console.
- Update the composition unit using the editCompUnit command.
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 we update a bundle that provides only OSGi services to the rest of the application, then only that bundle is restarted. If we 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.
Subtopics
- Checking the bundle download status of an EBA 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. Before you try and update bundle versions, we can check the bundle download status of the asset.
- Update bundle versions for an EBA asset
After you import the OSGi application as an asset, newer versions of the bundles or composite bundles that the asset uses might become available. You can configure the deployed asset to use an updated version of any bundle or composite bundle used by the asset. You can choose to use a specific bundle version, or to pull in the latest compatible version.
- Checking the update status of an OSGi composition unit
When you change the versions of bundles or composite bundles that an enterprise OSGi application uses, or add or remove a composite bundle extension, the bundles used by the deployed application can get out of synchronization with those bundles that are available. To check that the business-level application is running the most recent version of the EBA asset and any composite bundle extensions, you check the update status of the associated OSGi composition unit.
- Update an OSGi composition unit
If a new OSGi application deployment is available, we can update the OSGi composition unit so that the business-level application uses the newer configuration. If any of the updates contain configuration options, a wizard prompts you to update the configuration information.