我在Fuse中有一個CXF Web服務應用程序,並且它在駝峯上下文xml文件中獲取了一個包含從WSDL生成的文件的jar的引用。OSGi maven-bundle-plugin忽略我的包
<cxf:cxfEndpoint id="LookupEndpoint"
address="${my.LookupUri}"
serviceClass="com.whatever.IWebService"
wsdlURL="wsdl/MyWsdl.wsdl"/>
com.whatever.*
是我<Import-Package>
名單。該jar在我的maven依賴項中。我可以說import com.whatever.IWebService;
,它不會抱怨。
但行家束-插件不包含此包中的MANIFEST.MF
它包含了我所要求的一切我包等。但不是這個。所以在Fuse中,當我部署它時,我得到了ClassNotFoundException,引用了context.xml類的加載。
這是非常令人沮喪的。有沒有辦法強制插件導入某個包?因爲他們的自動神奇依賴求解器無視我<Import-Package>
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<version>${version.maven-bundle-plugin}</version>
<extensions>true</extensions>
<configuration>
<manifestLocation>src/main/resources/META-INF</manifestLocation>
<instructions>
<Bundle-SymbolicName>${project.artifactId}</Bundle-SymbolicName>
<Bundle-Version>${project.version}</Bundle-Version>
<Import-Package>
*,
com.imports.this.one.fine*,
com.imports.this.one.just.fine*,
com.imports.does.not.import.this.one.*,
</Import-Package>
<Export-Package>
com.something.export.*
</Export-Package>
</instructions>
</configuration>
</plugin>
Hi Neil,這個想法是我們將WSDLs及其生成的類存儲在捆綁包中。但他們只是像共享庫。然後我們有服務,它使用共享庫中的類來公開端點。 (它的工作原理。)但是隻有當這些包在MANIFEST.MF中。我會檢查現在是否隨機實例化代碼中的服務類修正了這個... – djb
就是這樣。 ObjectFactory of = new ObjectFactory(); ***** OSGi的兒子。謝謝你 – djb
不知道我很高興你把OSGi稱爲「*****的兒子」!首先,問題不是OSGi,而是其中一個構建工具,maven-bundle-plugin。其次,它所做的事情是有記錄的,非常合理。 –