Discussion:
POI 3.7 OSGi bundle with ooxml
ychawla
2011-11-20 23:28:34 UTC
Permalink
Hello All,
I am trying to process a xslx spreadsheet in the ServiceMix OSGi container.
I am running into lots of problems that I have documented on the ServiceMix
list:

http://servicemix.396122.n5.nabble.com/Apache-Poi-3-7-component-tc4912054.html

The error I am getting is:

Caused by: java.lang.NoClassDefFoundError: Could not initialize class
org.openxmlformats.schemas.drawingml.x2006.spreadsheetDrawing.CTDrawing
at
org.openxmlformats.schemas.drawingml.x2006.spreadsheetDrawing.CTDrawing$Factory.parse(Unknown
Source)[31:org.apache.servicemix.bundles.poi:3.7.0]
at
org.apache.poi.xssf.usermodel.XSSFDrawing.<init>(XSSFDrawing.java:80)[31:org.apache.servicemix.bundles.poi:3.7.0]


This error is explained in the FAQ:
http://poi.apache.org/faq.html#faq-N10025

I am using POI 3.7 and poi-scratchpad, poi-ooxml, and ooxml-schema (1.1)
dependencies. I have built a bundle that has all of the classes in it
including org.apache.poi.*, org.openxmlformats.schemas*, and the
schemaorg_apache_xmlbeans*. I am also excluding the poi-ooxml-schema
because I am trying to build the bundle with full support. I did try it
with the poi-ooxml-schema and that also produced the same error.

However, I can't seem to get around that runtime error.

Does anyone have any ideas on how to do this? It would be great to use with
ooxml in ServiceMix and any help would be appreciated.

Thanks,
Yogesh


--
View this message in context: http://apache-poi.1045710.n5.nabble.com/POI-3-7-OSGi-bundle-with-ooxml-tp5009063p5009063.html
Sent from the POI - User mailing list archive at Nabble.com.
Nick Burch
2011-11-21 00:34:57 UTC
Permalink
Post by ychawla
I am trying to process a xslx spreadsheet in the ServiceMix OSGi
container. I am running into lots of problems that I have documented on
http://servicemix.396122.n5.nabble.com/Apache-Poi-3-7-component-tc4912054.html
I wonder if you might be missing one of the xmlbeans dependencies, and
you're getting a spurious error from your classloader because of that?

FWIW, Apache Tika produces an OSGi bundle of all the Tika jars and their
dependencies, which includes POI and OOXML-Schemas. I've not heard of any
problems with people using that, so maybe you could find some hints in the
maven pom used for that?

Nick
Jon Svede
2011-11-21 01:41:04 UTC
Permalink
I have created Eclipse plug-ins using POI without issue.  Eclipse plug-ins are essentially OSGi bundles and I've never had this problem, but I always use pretty much everything:

dom4j-1.6.1.jar
poi-3.8-beta1-20101230.jar
poi-examples-3.8-beta1-20101230.jar
poi-ooxml-3.8-beta1-20101230.jar
poi-ooxml-schemas-3.8-beta1-20101230.jar
poi-scratchpad-3.8-beta1-20101230.jar
stax-api-1.0.1.jar
xmlbeans-2.3.0.jar

This is obviously using POI 3.8 and from a while ago, too, but it is demonstrative of what I needed to use.

Sincerely,

JOn
________________________________
Sent: Sunday, November 20, 2011 5:34 PM
Subject: Re: POI 3.7 OSGi bundle with ooxml
Post by ychawla
http://servicemix.396122.n5.nabble.com/Apache-Poi-3-7-component-tc4912054.html
I wonder if you might be missing one of the xmlbeans dependencies, and you're getting a spurious error from your classloader because of that?
FWIW, Apache Tika produces an OSGi bundle of all the Tika jars and their dependencies, which includes POI and OOXML-Schemas. I've not heard of any problems with people using that, so maybe you could find some hints in the maven pom used for that?
Nick
---------------------------------------------------------------------
ychawla
2011-11-21 03:58:47 UTC
Permalink
Hi Nick and Jon,
Thanks so much for the quick response. Your hints were very helpful. I
followed the Tika trail for a while but had some issues with it so I decided
to look into the XMLBeans configuration. ServiceMix uses XMLBeans 2.5.0 and
I figured it would be backwards compatible. Once I explicitly bundled
XMLBeans 2.3.0, it worked no problem.

I posted the POM file over on the ServiceMix listserve that I linked to in
an earlier post. Hopefully it will someone else looking to do this in an
OSGi container.

Cheers,
Yogesh

--
View this message in context: http://apache-poi.1045710.n5.nabble.com/POI-3-7-OSGi-bundle-with-ooxml-tp5009063p5009402.html
Sent from the POI - User mailing list archive at Nabble.com.

Loading...