Apache Karaf – Unable to resolve root: missing requirement – caused by: Unable to resolve java-api

Tags: , ,



I have Apache Karaf 4.0.1 running on a Linux Centos 7 server.

I get the following error:

org.osgi.service.resolver.ResolutionException: Unable to resolve root: missing requirement [root] osgi.identity; osgi.identity=travellinck-osgi; type=karaf.feature; version="[1.0.4,1.0.4]"; filter:="(&(osgi.identity=travellinck-osgi)(type=karaf.feature)(version>=1.0.4)(version<=1.0.4))" [caused by: Unable to resolve travellinck-osgi/1.0.4: missing requirement [travellinck-osgi/1.0.4] osgi.identity; osgi.identity=com.travellinck.transIT.java-api; type=osgi.bundle; version="[1.153.0,1.153.0]"; resolution:=mandatory [caused by: Unable to resolve com.travellinck.transIT.java-api/1.153.0: missing requirement [com.travellinck.transIT.java-api/1.153.0] osgi.wiring.package; filter:="(&(osgi.wiring.package=javax.jws)(version>=1.1.0)(!(version>=2.0.0)))"]]
    at org.apache.felix.resolver.Candidates.populateResource(Candidates.java:314)[org.apache.felix.framework-5.0.1.jar:] 

Any ideas?

I am a novice with apache-karaf/OSGi, so please excuse me if there is pertinent information lacking in this question, I would be glad to add info when suggested.

More info:

I build it using maven with Java1.7. I also tried building it with Java8, but there is no change.

In reference to this part of the error message:

caused by: Unable to resolve com.travellinck.transIT.java-api/1.153.0

In one of the modules, there is the following in the POM:

<modelVersion>4.0.0</modelVersion>
<groupId>com.travellinck.integration.vocabulary</groupId>
<artifactId>com.travellinck.transIT.java-api</artifactId>
<version>1.153.0</version>
<name>${bundle.name} ${project.version} [osgi]</name>
<packaging>bundle</packaging>
<description>Comprehensive travel services vocabulary</description>

Answer

I resolved this by removing these dependencies from the pom:

    <dependency>
        <groupId>javax.xml.bind</groupId>
        <artifactId>jaxb-api</artifactId>
        <version>2.2.7</version>
    </dependency>
    <dependency>
        <groupId>javax.xml.ws</groupId>
        <artifactId>jaxws-api</artifactId>
        <version>2.2.7</version>
    </dependency>
    <dependency>
        <groupId>com.sun.xml.ws</groupId>
        <artifactId>jaxws-ri</artifactId>
        <version>2.2.7</version>
        <type>pom</type>
    </dependency>
    <dependency>
        <groupId>javax.jws</groupId>
        <artifactId>javax.jws-api</artifactId>
        <version>1.1</version>
    </dependency>


Source: stackoverflow