I am doing this tutorial to learn OSGi. It creates a single JAX-RS Whiteboard service that serves a simple web page on port 8080. When I try to start it, it shows, among others, the error:
! Failed to start bundle org.apache.aries.jax.rs.whiteboard-1.0.6, exception Could not resolve module: org.apache.aries.jax.rs.whiteboard [10]
Unresolved requirement: Import-Package: javax.activation
from what I understand about OSGi so far, there needs to be a bundle running (or at least available to start) that exports the package javax.activation
, and since there is none, org.apache.aries.jax.rs.whiteboard
cannot start. I found a Maven package that sounds like it’s what I want: “Activation Repackaged For OSGi”. But how do I get it in there?
I have found tools that enable converting Maven artifacts to OSGi bundles. And I have found tutorials for adding manually-downloaded JARs to the application. But I searched for the Aries JAX-RS JAR (as an example) inside the tutorial project and found no preexisting JARs nor was it mentioned in any POM, so evidently all the existing deps were added through some other means. The Aries JAR is only mentioned in app.bndrun
. The BND file editor in Eclipse has a wizard to add more bundles to the runbundles
, but there is only a very limited selection and I can’t make sense of where they come from. That tutorial’s prerequisites page mentions the Maven2 repo, but trying to add that causes an Exception in Eclipse.
What would be the “canonical” way to add such a bundle, i.e. the same way that all the existing bundles are included? Is that Maven package that I found even likely to work? Or did I misconfigure something? After all, this should just work out of the box.
Thanks for any help.
app.bndrun
:
index: target/index.xml;name="app"
-standalone: ${index}
-runrequires: osgi.identity;filter:='(osgi.identity=org.osgi.enroute.examples.quickstart.rest)'
-runfw: org.eclipse.osgi
-runee: JavaSE-1.8
-resolve.effective: active
-runbundles:
ch.qos.logback.classic;version='[1.2.3,1.2.4)',
ch.qos.logback.core;version='[1.2.3,1.2.4)',
org.apache.aries.javax.jax.rs-api;version='[1.0.4,1.0.5)',
org.apache.felix.http.servlet-api;version='[1.1.2,1.1.3)',
org.osgi.service.jaxrs;version='[1.0.0,1.0.1)',
org.osgi.util.function;version='[1.1.0,1.1.1)',
org.osgi.util.promise;version='[1.1.0,1.1.1)',
slf4j.api;version='[1.7.25,1.7.26)',
org.apache.geronimo.specs.geronimo-annotation_1.3_spec;version='[1.1.0,1.1.1)',
org.apache.aries.jax.rs.whiteboard;version='[1.0.6,1.0.7)',
org.apache.felix.configadmin;version='[1.9.16,1.9.17)',
org.apache.felix.http.jetty;version='[4.0.14,4.0.15)',
org.apache.felix.scr;version='[2.1.16,2.1.17)',
org.osgi.enroute.examples.quickstart.rest;version='[0.0.2,0.0.3)'
``