My goal is to create an Excel 2007 document (XLSX) in an Eclipse RCP Environment (Excel 2003 is simple). I don't want to place the POI jars inside a /lib folder, instead I want to use a working POI OSGI bundle from my target definition.
All my attempts so far have failed to create a working OSGI bundle of POI 3.8. What I did so far:
I merged all relevant JAR files with the Ant zip task:
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 bundle the jars in the /ooxml-lib folder separately, with bnd:
This leads to ClassNotFoundExceptions for org.w3c.dom.Node
because xmlbeans-2.3.0.jar exports four classes from this package org.w3c.dom
. Normally the JavaSE-RuntimeEnvironment would export these.
I deleted the org/w3c/dom
folder from xmlbeans-2.3.0.jar and rebundled the jar but I got other ClassNotFoundExceptions.
This is where I got so far. I think working with bnd wrap is not enough. Probably I must create a bnd.properties file and have explicit Export-Package/Import-Package statements but which work?
So, has anyone successfully managed to create a working POI 3.8 OSGI bundle?
HSSF (Horrible Spreadsheet Format) − It is used to read and write xls format of MS-Excel files. XSSF (XML Spreadsheet Format) − It is used for xlsx file format of MS-Excel.
Creating CellsWorkbook wb = new HSSFWorkbook(); //Workbook wb = new XSSFWorkbook();
16 September 2022 - POI 5.2. The Apache POI team is pleased to announce the release of 5.2. 3. Featured are a handful of new areas of functionality and numerous bug fixes. A summary of changes is available in the Release Notes.
Apache POI provides Java API for manipulating various file formats based on the Office Open XML (OOXML) standard and OLE2 standard from Microsoft. Apache POI releases are available under the Apache License (V2. 0).
If you don't need that specific version, simply use http://ebr.springsource.com/repository/app/bundle/version/detail?name=com.springsource.org.apache.poi&version=3.0.2.FINAL that page lists it's dependencies etc (which you can also download or reference if you're using Maven/Ivy)
May be http://engroup.sourceforge.net/maven2/engroup/osgi/commons/poi-osgi/3.1/ or http://ebr.springsource.com/repository/app/search?query=poi can provide some inspiration (in the first link there's a maven POM that lists the (bnd) instructions in the bundle plugin section).
Why are you merging the jars? Why not try wrapping each individually?
A second thing to try is to use existing OSGi'd jars of xmlbeans, stax-api and dom4j
Also you can configure what the JRE (system bundle) exports using "org.osgi.framework.system.packages" - so you can choose not to export org.w3c.dom
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With