For a project I'm trying to get Excel XML functionality using Apache POI to work with OSGI.
I've tried the POI ServiceMix bundle, but this was missing the ooxml-schemas jar. Adding the jar to the bundle and including it in the manifest didn't seem to work.
Then I tried to creating wrapper bundles for POI 3.10, but also to no avail. Same error.
Caused by: java.lang.ClassNotFoundException: org.apache.xmlbeans.impl.schema.SchemaTypeSystemImpl not found by org.apache.poi [8]
at org.apache.felix.framework.BundleWiringImpl.findClassOrResourceByDelegation(BundleWiringImpl.java:1532)
at org.apache.felix.framework.BundleWiringImpl.access$400(BundleWiringImpl.java:75)
at org.apache.felix.framework.BundleWiringImpl$BundleClassLoader.loadClass(BundleWiringImpl.java:1955)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Unknown Source)
... 105 more
Subsequent calls lead to the following:
Caused by: java.lang.NoClassDefFoundError: Could not initialize class org.openxmlformats.schemas.drawingml.x2006.main.ThemeDocument
at org.openxmlformats.schemas.drawingml.x2006.main.ThemeDocument$Factory.parse(Unknown Source)
at org.apache.poi.xssf.model.ThemesTable.<init>(ThemesTable.java:44)
... 93 more
XMLBeans is available as a bundle exporting all of its packages, and I've tried the ServiceMix bundle as well as making one out of the jar included with POI 3.10.
Could someone guide me through the process of creating a working OSGI bundle that can handle Excel 2007+ XML documents? Help much appreciated.
The problem is that the classes from org.apache.poi.ooxml-schemas
call Class.forName("org.apache.xmlbeans.impl.schema")
, so you need an import of this package in the manifest of your ooxml-schemas bundle.
I solved it by adding <DynamicImport-Package>*</DynamicImport-Package>
to the configuration of the maven-bundle-plugin
when building the ooxml-schemas bundle.