gpt4 book ai didi

java - 使 Apache httpcomponents HttpClient 4.3.x OSGi 包在 Apache Karaf 2.3.x 上工作的问题

转载 作者:塔克拉玛干 更新时间:2023-11-02 07:47:32 27 4
gpt4 key购买 nike

尝试安装 httpclient-osgi 4.3.2 bundle(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)))

检查 header 时,它尝试加载的依赖项似乎被标记为 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 试图找到包的导出并且未能激活包。

这个包 list 有问题吗?还是我遗漏了什么?

PS:我尝试了旧的 4.3.x 和 Karaf 2.3.x 版本 - 结果相同。

最佳答案

您需要 HttpCore OSGi bundle 和导出 Commons Logging API 的 bundle 来满足 HttpClient OSGi bundle 的必要依赖性。

关于java - 使 Apache httpcomponents HttpClient 4.3.x OSGi 包在 Apache Karaf 2.3.x 上工作的问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22042354/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com