【发布时间】:2012-11-23 15:13:49
【问题描述】:
我需要处理 OSGi 包中的 xlsx Excel 文档,但 org.apache.servicemix.bundles.poi 缺少使用 2007 和更早格式的类。
我创建了一个带有完整 apache poi 的 OSGi 包(jar 文件)(包括官方 apache poi 包中不存在的 ooxml 类)。我用过this pom.
所以,经过一番努力,我得到了我想要的捆绑包。现在的问题是如何将它与我现有的捆绑包一起使用?我如何告诉它导入我需要的东西?从理论上讲,这个 pom 文件有 <servicemix.osgi.export> 列出要导出的命名空间,我应该能够将它们导入我的包中。
【问题讨论】:
-
org.apache.servicemix.bundles.poi 缺少使用 office 2007 格式的类。自我修复
-
你看过Export-package和Import-package,明白它们的意思了吗?或者至少表明您对 OSGi 的经验水平,以便人们知道您可能遇到什么样的问题。
-
我的 poi 包的导出具有这样的命名空间:
org.apache.poi*;-split-package:=merge-first, org.openxmlformats.schemas*;-split -package:=merge-first, ... 等 -
在我的项目中,我有“build helper maven plugin”,它附加了 features.xml 文件中的工件,我在其中添加了对 poi 包的依赖项。但是当我运行我的包时,它仍然有 ClassNotFoundException "org.apache.servicemix.bundles.poi [737] 找不到 org.apache.poi.ss.usermodel.WorkbookFactory" 为什么它寻找 "org.apache.servicemix.bundles .poi”?我根本没有这样的依赖。它应该在我的 poi 包中查找。
-
很难理解你的问题。你看过你的包的清单吗?它导入什么包?您是生成清单还是自己编写的?
标签: osgi openxml osgi-bundle apache-servicemix