2016-08-03 49 views
0

我正在使用MultipartbodyBuilder從REST Web服務客戶端發送文件和元數據。要使用如何從jar創建osgi包

在我的POM文件我已經加入

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

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

我還沒有加入到默這個功能在應用程序有關的任何捆綁的Feature.xml

當我嘗試在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,所以我想我需要一個映射到features.xml的osgi bundle http mime是一個沒有任何bundle的jar。有一個httpclient osgi包,但它有其他的依賴關係,它打破了我在xml中映射的其他項目。

我想知道如何使用httpmime 4.3.2 jar文件創建一個osgi包。我是新手,所以如果一些指導和參考將有所幫助。

+1

如果您可以提供有意義的標題並澄清您正在嘗試做什麼,那麼您更有可能獲得幫助。同樣,你應該用特定的語言來標記你的問題。 – miken32

回答

0

有一個稱爲包裹的卡拉夫功能。這使您也可以使用非OSGI jar文件。在您的feature.xml中,您只需將以下bundle添加到您的功能。

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

仍然得到相同的錯誤'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 - > 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 - > null | org.apache.cxf.jaxrs.client.JAXRSClientFactoryBean | 175-org.apache.cxf.cxf-rt-frontend-jaxrs-> net.sf.cglib.core .CodeGenerationException:java.lang.StackOverflowError - > null' – Jose

+0

對不起,我剛剛回答了有關如何從現有jar獲取OSGI插件的問題。我沒有看到錯誤以及它爲什麼會發生。 –