OSGI 捆绑包错误:捆绑包 73 中未解析的包:package=org.apache.commons.httpclient
- 我必须使用camel-http 组件。
- 我在POM文件中添加了依赖项。 (代码清单 1)
- 我开始收到 未解决的包错误 “package=org.apache.commons.httpclient”在运行时。
- 因此,我添加了 commons-httpclient 的依赖项(代码清单 2)。我将其添加到嵌入式依赖项中,因为 commons-httpclient 是一个非 osgi jar。
- 我仍然遇到同样的错误。
- 我还尝试在标签中添加这个包。
注意 - 我可以看到依赖项在我的捆绑包 jar 生成的 MANIFEST 文件中的 Import-Package 下得到反映。
代码清单 1:
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-http</artifactId>
<version>${camel-version}</version>
<!-- use the same version as your Camel core version -->
</dependency>
代码清单 2:
<dependency>
<groupId>commons-httpclient</groupId>
<artifactId>commons-httpclient</artifactId>
<version>3.1</version>
</dependency>
- I have to use camel-http component.
- I added the dependencies in the POM file. (Code Listing 1)
- I started getting Unresolved package error for
"package=org.apache.commons.httpclient" at Runtime. - So I have added the dependency for commons-httpclient (Code Listing 2). I added it in embedded-dependency because commons-httpclient is a non-osgi jar.
- I am still getting the same error.
- I also tried adding this package in tag.
Note - I can see the dependencies getting reflected under Import-Package, in the generated MANIFEST file of my bundle jar.
Code Listing 1:
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-http</artifactId>
<version>${camel-version}</version>
<!-- use the same version as your Camel core version -->
</dependency>
Code Listing 2:
<dependency>
<groupId>commons-httpclient</groupId>
<artifactId>commons-httpclient</artifactId>
<version>3.1</version>
</dependency>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
Servicemix 有一个用于 commons-httpclient 的 OSGi 包包装器,您可以尝试安装它而不是将其嵌入到您的包中吗?
mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.commons-httpclient/3.1_4
Servicemix has an OSGi bundle wrapper for the commons-httpclient, can you try to install it instead of embedding it in your bundle ?
mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.commons-httpclient/3.1_4