【问题标题】:how to create osgi bundle from jar如何从 jar 创建 osgi 包
【发布时间】:2016-08-03 16:30:20
【问题描述】:

我正在使用 MultipartbodyBuilder 从 REST Web 服务客户端发送文件和元数据。使用

在我的 pom 文件中我已经添加了

<dependency>
    <groupId>org.apache.httpcomponents</groupId>
    <artifactId>httpmime</artifactId>
    <version>4.3.2</version>
</dependency>

还有

<Embed-Dependency>
  http-mime
</Embed-Dependency>

我没有在应用程序 feature.xml 中添加任何与 mime 相关的捆绑包

当我尝试在 karaf 上安装该功能时,我在日志文件中收到以下错误并进入等待状态

->net.sf.cglib.core.CodeGenerationException: java.lang.StackOverflowError-->null
2016-08-03 20:10:22,456[SpringOsgiExtenderThread-58]|ERROR|org.apache.cxf.jaxrs.client.JAXRSClientFactoryBean|175-org.apache.cxf.cxf-rt-frontend-jaxrs-2.7.3|net.sf.cglib.core.CodeGenerationException : java.lang.RuntimeException-->net.sf.cglib.core.CodeGenerationException: java.lang.StackOverflowError-->null

我正在使用 karaf osgi,所以我认为我需要将 osgi 包映射到 features.xml http mime 是一个没有任何包的 jar。有一个 httpclient osgi 包,但它有其他依赖项,它破坏了我在功能 xml 中映射的其他项目。

我想知道如何使用 httpmime 4.3.2 jar 文件创建一个 osgi 包。我是新手,所以如果一些指导和参考会有所帮助。

【问题讨论】:

  • 如果你能提供一个有意义的标题,并阐明你想要做什么,你就更有可能获得帮助。同样,您应该使用特定语言标记您的问题。

标签: osgi-bundle apache-httpcomponents karaf


【解决方案1】:

有一个名为 wrap 的 karaf 功能。这也允许您使用非 OSGI jar 文件。在您的 feature.xml 中,您只需将以下 bundle 添加到您的功能中。

<bundle>wrap:mvn:org.apache.httpcomponents/httpmime/4.3.2</bundle>

【讨论】:

  • 仍然得到同样的错误org.apache.cxf.jaxrs.client.JAXRSClientFactoryBean|175-org.apache.cxf.cxf-rt-frontend-jaxrs-2.7.3|net.sf.cglib.core.CodeGenerationException : java.lang.reflect.InvocationTargetException--&gt;null org.apache.cxf.jaxrs.client.JAXRSClientFactoryBean|175-org.apache.cxf.cxf-rt-frontend-jaxrs-2.7.3|net.sf.cglib.core.CodeGenerationException : java.lang.StackOverflowError--&gt;null |org.apache.cxf.jaxrs.client.JAXRSClientFactoryBean|175-org.apache.cxf.cxf-rt-frontend-jaxrs-&gt;net.sf.cglib.core.CodeGenerationException: java.lang.StackOverflowError--&gt;null
  • 对不起,我刚刚回答了您关于如何从现有 jar 中获取 OSGI 插件的问题。我没有调查错误以及它发生的原因。
猜你喜欢
  • 1970-01-01
  • 2013-02-23
  • 2012-06-29
  • 2013-08-18
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2018-11-11
相关资源
最近更新 更多