Question

When trying to install the httpclient-osgi 4.3.2 bundle (org.apache.httpcomponents:httpclient-osgi:bundle:4.3.2 as specified on the HC Site) in an Apache Karaf OSGi container, I am getting the following error report:

karaf@root> install mvn:org.apache.httpcomponents/httpclient-osgi/4.3.2
Bundle ID: 60
karaf@root> start 60
Error executing command: Error starting bundles:
    Unable to start bundle 60: Unresolved constraint in bundle 
    org.apache.httpcomponents.httpclient [60]: Unable to resolve 60.0: 
    missing requirement [60.0] osgi.wiring.package; 
    (&(osgi.wiring.package=org.apache.http.concurrent)(version>=4.3.0)
    (!(version>=4.4.0)))

When inspecting the headers, it seems that the dependencies it tries to load are marked as Private-Package and classes can be found in the bundle JAR:

karaf@root> headers 60

=>

...
Private-Package = 
org.apache.commons.codec,
    org.apache.commons.codec.binary,
    org.apache.commons.codec.digest,
    org.apache.commons.codec.language,
    org.apache.commons.codec.language.bm,
    org.apache.commons.codec.net,
    org.apache.http,
    org.apache.http.annotation,
    org.apache.http.concurrent,
    org.apache.http.config,
    org.apache.http.entity,
    org.apache.http.impl,
    org.apache.http.impl.entity,
    org.apache.http.impl.io,
    org.apache.http.impl.pool,
    org.apache.http.io,
    org.apache.http.message,
    org.apache.http.osgi.impl,
    org.apache.http.params,
    org.apache.http.pool,
    org.apache.http.protocol,
    org.apache.http.util

At the same time, the org.apache.http* are also defined as Import-Package packages:

...
Import-Package = 
    javax.crypto,
    javax.crypto.spec,
    javax.net,
    javax.net.ssl,
    javax.security.auth.x500,
    org.ietf.jgss,
    org.osgi.framework;version="[1.5,2)",
    org.osgi.service.cm;version="[1.3,2)",
    org.apache.commons.logging;version="[1.1.0,1.2.0)",
    net.sf.ehcache;resolution:=optional,
    net.spy.memcached;resolution:=optional,
    org.apache.http.concurrent;version="[4.3.0,4.4.0)",
    org.apache.http.message;version="[4.3.0,4.4.0)",
    org.apache.http.impl.entity;version="[4.3.0,4.4.0)",
    org.apache.http.entity;version="[4.3.0,4.4.0)",
    org.apache.http.protocol;version="[4.3.0,4.4.0)",
    org.apache.http.impl.pool;version="[4.3.0,4.4.0)",
    org.apache.http;version="[4.3.0,4.4.0)",
    org.apache.http.params;version="[4.3.0,4.4.0)",
    org.apache.http.util;version="[4.3.0,4.4.0)",
    org.apache.http.io;version="[4.3.0,4.4.0)",
    org.apache.http.impl.io;version="[4.3.0,4.4.0)",
    org.apache.http.config;version="[4.3.0,4.4.0)",
    org.apache.http.pool;version="[4.3.0,4.4.0)",
    org.apache.http.impl;version="[4.3.0,4.4.0)"

Which seems to result in Karaf trying to find exports for the packages and failing to activate the bundle.

Is there something wrong with this bundle manifest? Or am I missing something?

PS: I tried older 4.3.x and Karaf 2.3.x versions - same outcome.

Was it helpful?

Solution

You need HttpCore OSGi bundle and a bundle exporting Commons Logging APIs to satisfy requisite dependencies of HttpClient OSGi bundle.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top