You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@jackrabbit.apache.org by Oleg Cohen <ol...@assurebridge.com> on 2018/01/15 20:30:37 UTC

Oak 1.8.0 and generated Require-Capability:

Greetings,

I am trying to use Oak 1.8.0 in an OSGi container and wonder is anyone could successfully get it to work.

I get an error when try to resolve oak-core. 

Unable to resolve org.apache.jackrabbit.oak-core/1.8.0: missing requirement [org.apache.jackrabbit.oak-core/1.8.0] osgi.service; filter:="(objectClass=com.codahale.metrics.MetricRegistry)"; effective:=active

I do load metrics-core v3.2.3 bundle as well. However there is no com.codahale.metrics.MetricRegistry OSGi service available. This is coming from a long Require-Capability: instruction generated by the Maven bundle plugin. When I compare 1.8 to 1.6 files I see that the latter don’t have these auto-generated Require-Cability: instructions.

Would appreciate any help!

Best regards,
Oleg

Re: Oak 1.8.0 and generated Require-Capability:

Posted by Oleg Cohen <ol...@assurebridge.com>.
Thank you, Robert! I will give it a try.

> On Jan 16, 2018, at 7:20 AM, Robert Munteanu <ro...@apache.org> wrote:
> 
> Hi Oleg,
> 
> On Mon, 2018-01-15 at 15:30 -0500, Oleg Cohen wrote:
>> Greetings,
>> 
>> I am trying to use Oak 1.8.0 in an OSGi container and wonder is
>> anyone could successfully get it to work.
>> 
>> I get an error when try to resolve oak-core. 
>> 
>> Unable to resolve org.apache.jackrabbit.oak-core/1.8.0: missing
>> requirement [org.apache.jackrabbit.oak-core/1.8.0] osgi.service;
>> filter:="(objectClass=com.codahale.metrics.MetricRegistry)";
>> effective:=active
>> 
>> I do load metrics-core v3.2.3 bundle as well. However there is no
>> com.codahale.metrics.MetricRegistry OSGi service available. This is
>> coming from a long Require-Capability: instruction generated by the
>> Maven bundle plugin. When I compare 1.8 to 1.6 files I see that the
>> latter don’t have these auto-generated Require-Cability:
>> instructions.
> 
> I looked at this a bit and here's what I found.
> 
> In CacheStatsMetrics [1] there is a reference to a MetricRegistry
> instance. We also register it in StatisticsProviderFactory [2] so from
> that POV we're fine.
> 
> I suspect bnd inspects service requirements and generates the Require-
> Capability instruction, but does not know anything about the manual
> service registration, leading to this situation.
> 
> For now, I suggest you add an additional bundle to your bundle which
> simply provides the required capability. If that works for you, please
> file a Jira for Oak and reference this discussion.
> 
> Thanks,
> 
> Robert
> 
> [1]: https://github.com/apache/jackrabbit-oak/blob/1.8/oak-core/src/mai <https://github.com/apache/jackrabbit-oak/blob/1.8/oak-core/src/mai>
> n/java/org/apache/jackrabbit/oak/cache/impl/CacheStatsMetrics.java#L79
> [2]: https://github.com/apache/jackrabbit-oak/blob/1.8/oak-core/src/mai <https://github.com/apache/jackrabbit-oak/blob/1.8/oak-core/src/mai>
> n/java/org/apache/jackrabbit/oak/plugins/metric/StatisticsProviderFacto
> ry.java#L151


Re: Oak 1.8.0 and generated Require-Capability:

Posted by Robert Munteanu <ro...@apache.org>.
Hi Oleg,

On Mon, 2018-01-15 at 15:30 -0500, Oleg Cohen wrote:
> Greetings,
> 
> I am trying to use Oak 1.8.0 in an OSGi container and wonder is
> anyone could successfully get it to work.
> 
> I get an error when try to resolve oak-core. 
> 
> Unable to resolve org.apache.jackrabbit.oak-core/1.8.0: missing
> requirement [org.apache.jackrabbit.oak-core/1.8.0] osgi.service;
> filter:="(objectClass=com.codahale.metrics.MetricRegistry)";
> effective:=active
> 
> I do load metrics-core v3.2.3 bundle as well. However there is no
> com.codahale.metrics.MetricRegistry OSGi service available. This is
> coming from a long Require-Capability: instruction generated by the
> Maven bundle plugin. When I compare 1.8 to 1.6 files I see that the
> latter don’t have these auto-generated Require-Cability:
> instructions.

I looked at this a bit and here's what I found.

In CacheStatsMetrics [1] there is a reference to a MetricRegistry
instance. We also register it in StatisticsProviderFactory [2] so from
that POV we're fine.

I suspect bnd inspects service requirements and generates the Require-
Capability instruction, but does not know anything about the manual
service registration, leading to this situation.

For now, I suggest you add an additional bundle to your bundle which
simply provides the required capability. If that works for you, please
file a Jira for Oak and reference this discussion.

Thanks,

Robert

[1]: https://github.com/apache/jackrabbit-oak/blob/1.8/oak-core/src/mai
n/java/org/apache/jackrabbit/oak/cache/impl/CacheStatsMetrics.java#L79
[2]: https://github.com/apache/jackrabbit-oak/blob/1.8/oak-core/src/mai
n/java/org/apache/jackrabbit/oak/plugins/metric/StatisticsProviderFacto
ry.java#L151