Error implementing a OSGI REST: `OSGi bundle not started : missing requirement`

1.1k views Asked by At

I'm trying to code a OSGI REST bundle with bndtools.

I added all the jars that I need in the cnf project. Then I added them to the bundle build path.

I get the following runtime exception

OSGi bundle not started : missing requirement osgi.wiring.package (&(osgi.wiring.package=javax.ws.rs)(version =2.0.0)( (version =3.0.0)))

I don't understand the error because I use javax.ws.rs-api 2.0.1.

I tried to specify the version explicitly in the buildpath like this

-buildpath: \
javax.ws.rs-api;version2.0.1 \

without any luck.

Do I use the wrong jar?

Thank you

Here's my bnd

-buildpath: \
    osgi.annotation,\
    osgi.core,\
    osgi.cmpn,\
    org.apache.felix.dependencymanager,\
    com.google.guava,\
    lmca.ps.util;version=latest,\
    lmca.ps.infrastructure;version=latest,\
    org.ops4j.pax.logging.pax-logging-api,\
    com.fasterxml.jackson.core.jackson-annotations,\
    com.fasterxml.jackson.core.jackson-core,\
    com.fasterxml.jackson.core.jackson-databind,\
    com.fasterxml.jackson.jaxrs.jackson-jaxrs-base,\
    com.fasterxml.jackson.jaxrs.jackson-jaxrs-json-provider,\
    com.fasterxml.jackson.module.jackson-module-jaxb-annotations,\
    org.eclipse.jetty.alpn.server,\
    org.eclipse.jetty.annotations,\
    org.eclipse.jetty.cdi.core,\
    org.eclipse.jetty.cdi.servlet,\
    org.eclipse.jetty.cdi.websocket,\
    org.eclipse.jetty.client,\
    org.eclipse.jetty.continuation,\
    org.eclipse.jetty.deploy,\
    org.eclipse.jetty.gcloud.session,\
    org.eclipse.jetty.http,\
    org.eclipse.jetty.infinispan,\
    org.eclipse.jetty.io,\
    org.eclipse.jetty.jaas,\
    org.eclipse.jetty.jmx,\
    org.eclipse.jetty.jndi,\
    org.eclipse.jetty.memcached.session,\
    org.eclipse.jetty.nosql,\
    org.eclipse.jetty.plus,\
    org.eclipse.jetty.proxy,\
    org.eclipse.jetty.quickstart,\
    org.eclipse.jetty.rewrite,\
    org.eclipse.jetty.schemas,\
    org.eclipse.jetty.security,\
    org.eclipse.jetty.security.jaspi,\
    org.eclipse.jetty.server,\
    org.eclipse.jetty.servlet,\
    org.eclipse.jetty.servlets,\
    org.eclipse.jetty.unixsocket,\
    org.eclipse.jetty.util,\
    org.eclipse.jetty.webapp,\
    org.eclipse.jetty.xml,\
    org.glassfish.hk2.api,\
    org.glassfish.hk2.external.aopalliance-repackaged,\
    org.glassfish.hk2.external.javax.inject,\
    org.glassfish.hk2.locator,\
    org.glassfish.hk2.osgi-resource-locator,\
    org.glassfish.hk2.utils,\
    org.glassfish.jersey.bundles.repackaged.jersey-guava,\
    org.glassfish.jersey.containers.jersey-container-servlet,\
    org.glassfish.jersey.containers.jersey-container-servlet-core,\
    org.glassfish.jersey.core.jersey-client,\
    org.glassfish.jersey.core.jersey-common,\
    org.glassfish.jersey.core.jersey-server,\
    org.glassfish.jersey.media.jersey-media-jaxb,\
    javax.servlet-api,\
    javax.annotation-api,\
    javax.jms-api,\
    javax.validation.api,\
    jaxb-api,\
    slf4j.api,\
    org.osgi.service.log,\
    org.ops4j.pax.logging.pax-logging-service,\
    org.ops4j.pax.logging.pax-logging-logback,\
    json,\
    javax.ws.rs-api,\
    persistence-api,\
    javassist
-runfw: org.apache.felix.framework;version='[5.6.1,5.6.1]'
-runee: JavaSE/compact1-1.9
-runrequires: \
    osgi.identity;filter:='(osgi.identity=org.apache.felix.dependencymanager.shell)',\
    osgi.identity;filter:='(osgi.identity=org.apache.felix.dependencymanager)',\
    osgi.identity;filter:='(osgi.identity=org.apache.felix.gogo.command)',\
    osgi.identity;filter:='(osgi.identity=org.apache.felix.gogo.runtime)',\
    osgi.identity;filter:='(osgi.identity=org.apache.felix.gogo.shell)',\
    osgi.identity;filter:='(osgi.identity=com.google.guava)',\
    osgi.identity;filter:='(osgi.identity=org.apache.felix.scr)',\
    osgi.identity;filter:='(osgi.identity=org.apache.felix.fileinstall)',\
    osgi.identity;filter:='(osgi.identity=org.apache.felix.configadmin)',\
    osgi.identity;filter:='(osgi.identity=lmca.ps.util)',\
    osgi.identity;filter:='(osgi.identity=lmca.ps.infrastructure)',\
    osgi.identity;filter:='(osgi.identity=org.apache.felix.log)',\
    osgi.identity;filter:='(osgi.identity=org.ops4j.pax.logging.pax-logging-service)',\
    osgi.identity;filter:='(osgi.identity=jaxb-api)'
-runbundles: \
    ch.qos.logback.classic;version='[1.1.7,1.1.8)',\
    ch.qos.logback.core;version='[1.1.7,1.1.8)',\
    com.google.guava;version='[20.0.0,20.0.1)',\
    org.apache.felix.configadmin;version='[1.8.12,1.8.13)',\
    org.apache.felix.dependencymanager;version='[4.3.0,4.3.1)',\
    org.apache.felix.dependencymanager.shell;version='[4.0.4,4.0.5)',\
    org.apache.felix.gogo.command;version='[0.16.0,0.16.1)',\
    org.apache.felix.gogo.runtime;version='[0.16.2,0.16.3)',\
    org.apache.felix.gogo.shell;version='[0.10.0,0.10.1)',\
    org.apache.felix.metatype;version='[1.1.2,1.1.3)',\
    slf4j.api;version='[1.7.21,1.7.22)',\
    org.apache.felix.fileinstall;version='[3.5.4,3.5.5)',\
    org.apache.felix.scr;version='[2.0.6,2.0.7)',\
    lmca.ps.util;version=snapshot,\
    lmca.ps.infrastructure;version=snapshot,\
    org.apache.felix.log;version='[1.0.1,1.0.2)',\
    org.ops4j.pax.logging.pax-logging-api;version='[1.9.1,1.9.2)',\
    org.ops4j.pax.logging.pax-logging-service;version='[1.9.1,1.9.2)'
Bundle-Name: foo.bar
Bundle-Description: Example bundle
-runvm: -Dfelix.fileinstall.dir=/home/bar\n\
    -Dfelix.fileinstall.noInitialDelay=true\n\
    -Dfelix.fileinstall.poll=1000\n\
    -Dorg.ops4j.pax.logging.DefaultServiceLog.level=INFO
Bundle-Activator: foo.bar.Activator
Private-Package: foo.bar

The complete error is

could not resolve the bundles: [foo.bar-0.0.0 org.osgi.framework.BundleException: Unable to resolve foo.bar [19](R 19.0): missing requirement [foo.bar [19](R 19.0)] osgi.wiring.package; (&(osgi.wiring.package=javax.ws.rs)(version>=2.0.0)(!(version>=3.0.0))) Unresolved requirements: [[foo.bar [19](R 19.0)] osgi.wiring.package; (&(osgi.wiring.package=javax.ws.rs)(version>=2.0.0)(!(version>=3.0.0)))]
]

Failed to start bundle foo.bar-0.0.0, exception Unable to resolve foo.bar [19](R 19.0): missing requirement [foo.bar [19](R 19.0)] osgi.wiring.package; (&(osgi.wiring.package=javax.ws.rs)(version>=2.0.0)(!(version>=3.0.0))) Unresolved requirements: [[foo.bar [19](R 19.0)] osgi.wiring.package; (&(osgi.wiring.package=javax.ws.rs)(version>=2.0.0)(!(version>=3.0.0)))]
1

There are 1 answers

0
Marc On BEST ANSWER

I had to change the

-runee: JavaSE/compact1-1.9

to

-runee: JavaSE-1.8