You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@karaf.apache.org by Sergiy Shyrkov <my...@gmail.com> on 2016/08/29 11:24:50 UTC

Using CellarBundleMBean with Karaf 4.0.6

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

Re: Using CellarBundleMBean with Karaf 4.0.6

Posted by Sergiy Shyrkov <my...@gmail.com>.
Hello JB,

thank you for the prompt reply and the created ticket (KARAF-4678)!
I can confirm that adding the provide-capability (adding a line  
"@ProvideService(CellarBundleMBean.class)" into  
org.apache.karaf.cellar.bundle.internal.osgi.Activator) solves our issue  
with feature startup.

Kind regards
Sergiy

On Mon, 29 Aug 2016 13:49:56 +0200, Jean-Baptiste Onofré <jb...@nanthrax.net>  
wrote:

> Hi Sergiy,
>
> As soon as your features XML use a namespace greater than 1.2.0, then  
> the service enforcement is performed by the resolver.
>
> However, there was a bug in Karaf 4.0.5 and previous where the service  
> enforcement was checked for namespace 1.3.0 but NOT for 1.4.0 (whereas  
> it should). It's now fixed, that's why the service enforcement is now  
> performed by the resolver (as you using xmlns 1.4.0).
>
> Now, back on your point, you are right, Cellar should provide the  
> service capability.
>
> I gonna fix that that.
>
> Regards
> JB
>
> On 08/29/2016 01:24 PM, Sergiy Shyrkov wrote:
>> 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

Re: Using CellarBundleMBean with Karaf 4.0.6

Posted by Jean-Baptiste Onofré <jb...@nanthrax.net>.
Hi Sergiy,

As soon as your features XML use a namespace greater than 1.2.0, then 
the service enforcement is performed by the resolver.

However, there was a bug in Karaf 4.0.5 and previous where the service 
enforcement was checked for namespace 1.3.0 but NOT for 1.4.0 (whereas 
it should). It's now fixed, that's why the service enforcement is now 
performed by the resolver (as you using xmlns 1.4.0).

Now, back on your point, you are right, Cellar should provide the 
service capability.

I gonna fix that that.

Regards
JB

On 08/29/2016 01:24 PM, Sergiy Shyrkov wrote:
> 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
>

-- 
Jean-Baptiste Onofr
jbonofre@apache.org
http://blog.nanthrax.net
Talend - http://www.talend.com