Issue
While deploying new version of the osgi jar, the services/component configurations are bound with the old version of the jar instead of new one.
Symptoms
You see one of the following messages in the log file:
- *ERROR* [OsgiInstallerImpl] org.apache.felix.scr Cannot use configuration pid= for bundle jcrinstall: because it belongs to bundle jcrinstall:"
Solution
- Go to the configuration page at http://<host>:<port>/system/console/configMgr and select your component.
- Unlink the existing configuration by clicking unbind as shown in the snapshot below.
- Click OK in the confirmation dialog box.
- Edit and save the configuration.
Best practice
To avoid this issue happening again in your continuous delivery process, the automated deployment script takes care of following things:
- Always install from repository and do not mix match with installing directly from felix console.
- New version bundles are added always and old version bundle are not deleted.
- The package filter should include the jar path (/apps/<appname>/install/<bundleNamewithversion>.jar) and not mention the parent folder /apps/<appname>/install
- If there is scenario that old bundle has to be deleted before deploying a new bundle, make sure after deleting the bundle and before installing new bundle below actions are in place
- Unbind the configuration.
- Refresh the packages at http://<host>:<port>/system/console/bundles.
If you have any questions or concerns about this issue, join the discussion at the forums Article to address unable to use configuration pid.
Additional information
When the bundle is first installed the configuration gets bound to the current location. When you update a bundle by uninstalling the old version and then installing the new version, the new install has a new different bundle location and hence the configuration cannot be used.