Getting java.lang.NoClassDefFoundError with ODF Toolkit

Not sure where to post? Post here!

Getting java.lang.NoClassDefFoundError with ODF Toolkit

Postby ravi.joshi53 » Thu Aug 15, 2013 1:34 pm

Hi,
I am trying to read an ods file using Apache ODF Toolkit. I am getting java.lang.NoClassDefFoundError error while while trying execute the code provided here http://incubator.apache.org/odftoolkit/ ... demo6.html

I done debugging the code and found that below line is causing the error-
SpreadsheetDocument data = SpreadsheetDocument.loadDocument(file);

Below is the error trace-
Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/xerces/dom/ElementNSImpl
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClassCond(Unknown Source)
at java.lang.ClassLoader.defineClass(Unknown Source)
at java.security.SecureClassLoader.defineClass(Unknown Source)
at java.net.URLClassLoader.defineClass(Unknown Source)
at java.net.URLClassLoader.access$000(Unknown Source)
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClassCond(Unknown Source)
at java.lang.ClassLoader.defineClass(Unknown Source)
at java.security.SecureClassLoader.defineClass(Unknown Source)
at java.net.URLClassLoader.defineClass(Unknown Source)
at java.net.URLClassLoader.access$000(Unknown Source)
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at test.read.ODSFile.ReadODS.main(ReadODS.java:33)
Caused by: java.lang.ClassNotFoundException: org.apache.xerces.dom.ElementNSImpl
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
... 25 more

odfdom-java-0.8.9-incubating.jar and simple-odf-0.8-incubating.jar are in classpath. Later on from here http://incubator.apache.org/odftoolkit/ ... guide.html I added Apache Xerces 2.11 to the classpath also. Still facing the problem. Below is the error trace-

Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/clerezza/utils/UriException
at org.odftoolkit.odfdom.pkg.OdfPackage.getBaseURLFromFile(OdfPackage.java:2226)
at org.odftoolkit.odfdom.pkg.OdfPackage.loadPackage(OdfPackage.java:320)
at org.odftoolkit.simple.Document.loadDocument(Document.java:328)
at org.odftoolkit.simple.SpreadsheetDocument.loadDocument(SpreadsheetDocument.java:205)
at test.read.ODSFile.ReadODS.main(ReadODS.java:33)
Caused by: java.lang.ClassNotFoundException: org.apache.clerezza.utils.UriException
at java.net.URLClassLoader$1.run(Unknown Source)
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
... 5 more
I am now ended up with adding dependencies. My objective is just to read some cells from an ods file. Can anybody please provide the list of all the jars needed just to read ods file?

Thanks
ravi.joshi53
 
Posts: 3
Joined: Thu Aug 15, 2013 1:03 pm

Return to Beginners

Who is online

Users browsing this forum: No registered users and 2 guests