skip to Main Content

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>

2

Answers


  1. Chosen as BEST 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>
    

  2. In the end of your error, it says : "Hey, I miss this package : javax.jws, and I want it with version >= 1.1 but not superior of 2.0.0"

    You fixed that problem by removing all those dependencies.

    <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>
    

    Why does it need it ? Because the maven-bundle-plugin that you surely use, scan the dependencies and creates Import-Package clauses in the MANIFEST.MF which list all the packages needed to run your bundle.

    If you didn’t needed them, good ! But if in the end you needed them, it’s not a problem ! You just have to ensure that the package javax.jws is installed with the version 1.1.

    I suppose this package is exported by javax.jws-api, which has a similar name and is also at version 1.1. So, in your karaf, you can do bundle:install mvn:javax.jws/javax.jws-api/1.1 and in theory, your bundle will found the required packages now

    To be sure, you can download the jar from maven central repo and check in it the META-INF/MANIFEST.MF, which contains :

    Export-Package: javax.jws;version="1.1.0",javax.jws.soap;version="1.1.0"
    

    This means "I’m the exporter of javax.jws package at version 1.1.0". If you install it, your other bundle will be able to find that package.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search