I have one bundle which has Import-Package org.osgi.service.cm
. In this bundle there is only an interface ConfigurationInterface
, that declares a couple of methods, one throws an org.osgi.service.cm.ConfigurationException
. This bundle exports only its own package, lets say com.foo.bar.configuration
.
Then I have other API bundles that have an interface for the service, ServiceInterface
, that extends ConfigurationInterface
, so they are importing the package com.foo.bar.configuration
. Obviously there are also implementations bundle for these api that implement ServiceInterface
, so they are importing org.osgi.service.cm
because every implementations need to have the method that throws an org.osgi.service.cm.ConfigurationException
.
Everything is working fine, the problems come out when I declare these services as optional, because when they are not available the framework tries to instantiate a proxy from the interface and I get a java.lang.ClassNotFoundException: org.osgi.service.cm.ConfigurationException
. The framework suggests to add an import for 'org.osgi.service.cm' to the API bundle.
Is there a way to make this import available from the configuration bundle so that it is not necessary to add the import to every API?