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
