java.lang.NoClassDefFoundError: Could not initialize class org.apache.poi.openxml4j.opc.internal.marshallers.ZipPackagePropertiesMarshaller

Rizwan Shaikh picture Rizwan Shaikh · Jan 27, 2015 · Viewed 10.8k times · Source

I am trying to generate Excel using Xssf API because its memory footprint is small. It is working fine in my local machine which is having jdk1.7. But when I try to run it on UNIX where java version is 1.6.0_75 it gives me the following error.

java.lang.NoClassDefFoundError: Could not initialize class org.apache.poi.openxml4j.opc.internal.marshallers.ZipPackagePropertiesMarshaller

I have following jars in my classpath

  • poi-3.11-20141221.jar
  • poi-excelant-3.11-20141221.jar
  • poi-ooxml-3.11-20141221.jar
  • poi-ooxml-schemas-3.11-20141221.jar
  • xmlbeans-2.6.0.jar
  • xercesImpl.jar

I have verified that poi-3.11-20141221.jar has the ZipPackagePropertiesMarshaller class.

Seems that some jar is missing. Am I missing something?

Answer

Rizwan Shaikh picture Rizwan Shaikh · Jan 27, 2015

I have found a solution to my own problem. I replaced poi-3.11-20141221.jar with poi-ooxml-3.9.jar. That worked.