>>>>> Steinar Bang <[email protected]>:
>>>>> Jean-Baptiste Onofré <[email protected]>:
>>> Hi,
>>> packages:exports|grep -i package
>>> You will have the package with version and the ID of bundles providing it.
> karaf@root()> package:exports | grep inject
> javax.inject | 1.0.0 | 95 |
> org.glassfish.hk2.external.jakarta.inject
> org.glassfish.jersey.inject.hk2 | 2.28.0 | 105 |
> org.glassfish.jersey.inject.jersey-hk2
> org.glassfish.jersey.internal.inject | 2.28.0 | 102 |
> org.glassfish.jersey.core.jersey-common
> org.glassfish.jersey.server.internal.inject | 2.28.0 | 103 |
> org.glassfish.jersey.core.jersey-server
> karaf@root()>
> ...so I guess scratch the theory of multiple bundles offering up
> javax.inject...?
On the other hand the error message I'm getting, is:
2020-02-03T22:17:15,772 | ERROR | features-2-thread-1 | Felix
| - - | Bundle org.ops4j.pax.web.pax-web-extender-whiteboard [112]
EventDispatcher: Error during dispatch. (java.lang.NoClassDefFoundError:
javax/annotation/Priority)
java.lang.NoClassDefFoundError: javax/annotation/Priority
and javax.annotation has two candidates, one from the felix framework
itself:
karaf@root()> package:exports | grep javax\.annotation
javax.annotation.processing | 1.0.0 | 0 | org.apache.felix.framework
javax.annotation.security | 1.3.0 | 51 | javax.annotation-api
javax.annotation.sql | 1.3.0 | 51 | javax.annotation-api
javax.annotation | 1.0.0 | 0 | org.apache.felix.framework
javax.annotation | 1.3.0 | 51 | javax.annotation-api
karaf@root()>
However a pattern matching everything from 1.0 to (but not including)
2.0 should pick the 1.3.0 version, and indeed that's what seems to
happen:
karaf@root()> bundle:capabilities 51
javax.annotation-api [51] provides:
-----------------------------------
osgi.wiring.bundle; javax.annotation-api 1.3.0 [UNUSED]
osgi.wiring.host; javax.annotation-api 1.3.0 [UNUSED]
osgi.identity; javax.annotation-api 1.3.0 [UNUSED]
osgi.wiring.package; javax.annotation 1.3.0 required by:
org.ops4j.pax.web.pax-web-jetty [113]
org.glassfish.hk2.utils [98]
osgi.wiring.package; javax.annotation.security 1.3.0 required by:
org.glassfish.jersey.core.jersey-server [103]
org.glassfish.jersey.ext.jersey-entity-filtering [104]
osgi.wiring.package; javax.annotation.sql 1.3.0 [UNUSED]
karaf@root()>
And the error message sounds similar to what one gets when using
Class.forName() in OSGi when the class is outside of the current
bundle. So maybe I'm running OSGi-incompatible reflection code?
HK2 as a bundle named something like OSGi locator. And that one doesn't
seem to be loaded. Instead, this one is loaded:
96 | Active | 80 | 2.5.0 | ServiceLocator Default Implementation