尝试安装 httpclient-osgi 4.3.2软件包(org.apache.httpcomponents:httpclient-osgi:bundle:4.3.2,如HC Site所述) Apache Karaf OSGi容器,我收到以下错误报告:
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)))
检查标题时,它尝试加载的依赖项似乎标记为 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
同时,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)"
这似乎导致Karaf试图找到包裹的出口并且未能激活捆绑包。
这个捆绑包清单有问题吗?或者我错过了什么?
PS:我尝试过较旧的4.3.x和Karaf 2.3.x版本 - 结果相同。
答案 0 :(得分:5)
您需要HttpCore OSGi包和一个导出Commons Logging API的包,以满足HttpClient OSGi包的必要依赖性。