Olzhas
Olzhas

Reputation: 235

exception while reading Excel file with apache poi

Problem reading Excel 2007 file .xlsx file extention, while I am trying to read with apache poi:

InputStream file = new FileInputStream(C:\\test.xlsx);

---> XSSFWorkbook workbook = new XSSFWorkbook(file);

This line giving me an exception Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/xmlbeans/XmlObject please, what can be cause of this error?

Upvotes: 3

Views: 27611

Answers (5)

Ramesh
Ramesh

Reputation: 1

I downloaded xmlbeans.jar and added to Library as External Jar. It resolved my issue.

Upvotes: 0

Abubakkar
Abubakkar

Reputation: 15644

you need to include a jar file named xmlbeans-x.x.x.jar that comes under folder "your_location_of_poi\poi-x.x\ooxml-lib\" in your classpath.

Note: x.x is the version of poi that you are using and x.x.x is the version number of that jar file under the above mentioned folder

Upvotes: 14

awm
awm

Reputation: 2768

You're missing the extra jar files that come with POI. Include them in your classpath.

Upvotes: 1

Dan D.
Dan D.

Reputation: 32391

You don't have XMLBeans in your classpath.

Upvotes: 0

Related Questions