简体   繁体   English

获取Apache httpconents HttpClient 4.3.x OSGi包以解决Apache Karaf 2.3.x的问题

[英]Problems with getting Apache httpcomponents HttpClient 4.3.x OSGi bundle to work on Apache Karaf 2.3.x

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: 当尝试在Apache Karaf OSGi容器中安装httpclient-osgi 4.3.2软件包 (org.apache.httpcomponents:httpclient-osgi:bundle:4.3.2,如HC网站上指定)时,我收到以下错误报告:

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: 在检查标头时,似乎它尝试加载的依赖项被标记为Private-Package,并且可以在包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: 同时,org.apache.http *也被定义为Import-Package包:

...
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. 这似乎导致Karaf试图找到包的出口并且未能激活捆绑包。

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. PS:我尝试过较旧的4.3.x和Karaf 2.3.x版本 - 结果相同。

您需要HttpCore OSGi包和一个导出Commons Logging API的包,以满足HttpClient OSGi包的必要依赖性。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM