How to create an OSGI working kit for Apache POI 3.8?

My goal is to create an Excel 2007 document (.xlsx) in an Eclipse RCP environment (Excel 2003 is simple). I do not want to place POI banners inside the / lib folder , instead I want to use the OSGI package for POI from my target definition.

All my attempts so far have not been able to create a working package OSGI POI 3.8 . What i have done so far:

  • I combined all the relevant JAR files with the Ant zip task :

    • poi-3.8-beta3-20110606.jar
    • poi-OOXML-3,8-beta3-20110606.jar
    • poi-ooxml-scheme-3.8-beta3-20110606.jar
    • poi-notepad-3,8-beta3-20110606.jar
  • I ran the bnd tool with the wrap parameter:java -jar biz.aQute.bnd.jar wrap ./poi-3.8-beta3-20110606-merged.jar

  • I had to bind the banks in the / ooxml -lib folder separately, using bnd:

    • XMLBeans-2.3.0.jar
    • Stax-api-1.0.1.jar
    • dom4j-1.6.1.jar
  • This results in ClassNotFoundExceptions for org.w3c.dom.Node, because xmlbeans-2.3.0.jar exports four classes from this package org.w3c.dom. Typically, JavaSE-RuntimeEnvironment exports these files.

  • I deleted the folder org/w3c/domfrom xmlbeans-2.3.0.jar and rebuilt the jar, but I have other ClassNotFoundExceptions.

I got here. I think working with bnd wrap is not enough. Maybe I should create a bnd.properties file and have explicit Export-Package / Import-Package instructions, but which ones work?

So, did anyone successfully create the POI 3.8 OSGI work package?

+5
source share
4

3.8, OSGi 3.7 Bnd.

-classpath: poi-3.7-20101029.jar, 
  poi-ooxml-3.7-20101029.jar,
  poi-ooxml-schemas-3.7-20101029.jar, 
  poi-scratchpad-3.7-20101029.jar
Bundle-Name: Apache POI
Bundle-SymbolicName: org.apache.poi
Bundle-Version: 3.7.0
Bundle-ClassPath: .
Private-Package: *
Export-Package: org.apache.poi.*;-split-package:=merge-first
Import-Package: !org.openxmlformats.schemas*, \
  !schemasMicrosoftComOfficePowerpoint*, \
  !schemasMicrosoftComOfficeWord*, \
  junit*;resolution:=optional, \
  org.apache.commons.logging;resolution:=optional, \
  *
Include-Resource: @poi-3.7-20101029.jar, \
  @poi-ooxml-3.7-20101029.jar, \
  @poi-ooxml-schemas-3.7-20101029.jar, \
  @poi-scratchpad-3.7-20101029.jar
+1

All Articles