当尝试在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)))
检查标头时,它尝试加载的依赖项似乎被标记为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 版本 - 结果相同。