Hello guys,

I would like to ask you about the recommended way of using the functionality from the CellarBundleMBean, which is responsible for clustered bundle operations in Cellar, in our custom Java code.

So far we were using it as a service in our code as follows (via SCR):

    @Reference(service = CellarBundleMBean.class)
protected void bindCellarBundleService(CellarBundleMBean cellarBundleService) {
        this.cellarBundleService = cellarBundleService;
    }

and it was working good until I tried to upgrade today to the latest Karaf 4.0.6 :-)

There was a change in Karaf 4.0.6 that now enforces service capability checks when resolving a feature (a discussion of an "issue" can be found in the mailing thread "[VOTE] Apache Karaf (Container) 4.0.6 release" in dev mailing list).

So with Karaf 4.0.6 our feature fails to be resolved with an error:

2016-08-29 11:59:36,718: ERROR [ShellUtil] - Exception caught while executing command org.osgi.service.resolver.ResolutionException: Unable to resolve root: missing requirement [root] osgi.identity; osgi.identity=dx-clustering; type=karaf.feature; version="[7.2.0.0-SNAPSHOT,7.2.0.0-SNAPSHOT]"; filter:="(&(osgi.identity=dx-clustering)(type=karaf.feature)(version>=7.2.0.0-SNAPSHOT)(version<=7.2.0.0-SNAPSHOT))" [caused by: Unable to resolve dx-clustering/7.2.0.0-SNAPSHOT: missing requirement [dx-clustering/7.2.0.0-SNAPSHOT] osgi.identity; osgi.identity=org.jahia.bundles.clustering; type=osgi.bundle; version="[7.2.0.0-SNAPSHOT,7.2.0.0-SNAPSHOT]"; resolution:=mandatory [caused by: Unable to resolve org.jahia.bundles.clustering/7.2.0.0-SNAPSHOT: missing requirement [org.jahia.bundles.clustering/7.2.0.0-SNAPSHOT] osgi.service; effective:=active; filter:="(objectClass=org.apache.karaf.cellar.bundle.management.CellarBundleMBean)"]] at org.apache.felix.resolver.ResolutionError.toException(ResolutionError.java:42) at org.apache.felix.resolver.ResolverImpl.resolve(ResolverImpl.java:235) at org.apache.felix.resolver.ResolverImpl.resolve(ResolverImpl.java:158) at org.apache.karaf.features.internal.region.SubsystemResolver.resolve(SubsystemResolver.java:216) at org.apache.karaf.features.internal.service.Deployer.deploy(Deployer.java:263) at org.apache.karaf.features.internal.service.FeaturesServiceImpl.doProvision(FeaturesServiceImpl.java:1176) at org.apache.karaf.features.internal.service.FeaturesServiceImpl$1.call(FeaturesServiceImpl.java:1074)
        at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
        at java.lang.Thread.run(Thread.java:745)


because org.apache.karaf.cellar.bundle does not actually provide the corresponding capability (although it exposes the CellarBundleMBean service).


What could be recommended in my case?
Should I get rid of the service dependency and try to use the functionality via JMX? Or there are other more appropriate ways to make it work with Karaf 4.0.6?

I will appreciate any hints, thank you in advance!


Kind regards
Sergiy

--
Sergiy Shyrkov
Software Architect
Jahia Solutions Group SA
http://www.jahia.com

Reply via email to