views:

341

answers:

3

I am using poi-3.5-beta5 to read excel file.
I am trying to open excel file through XSSFWorkbook workBook = new XSSFWorkbook (xlsPath);

i am getting following error (although i am not using log4j)

Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/log4j/Logger at org.apache.poi.openxml4j.opc.Package.(Package.java:63) at org.apache.poi.POIXMLDocument.openPackage(POIXMLDocument.java:63) at org.apache.poi.xssf.usermodel.XSSFWorkbook.(XSSFWorkbook.java:173) at test.ExcelReader.displayFromExcel(ExcelReader.java:44) at test.ExcelReader.main(ExcelReader.java:138)

Please help me to sole this problem. Thanks

A: 

Looks like you need Log4J on your classpath.

Brian Agnew
+1  A: 

POI probably has a dependency on log4j. Just include the log4j jar in your classpath.

Roy Tang
A: 

If U have that problem still, I want to give you some information:

May be you might not include poi-ooxml-version.jar file.

Since you're processing Excel format 2007, the XSSF Format implementations are included in this jar file...

venJava