InputStream of class class java.util.zip.InflaterInputStream is not implementing InputStreamStatistics

178 Views Asked by At

I was trying to load an excel into POI workbook with the below constructor

Workbook workbook = new XSSFWorkbook(file.getAbsolutePath());

but got

[main] WARN org.apache.poi.openxml4j.opc.OPCPackage - Unable to call close() on a package that hasn't been fully opened yet
Exception in thread "main" java.lang.IllegalArgumentException: InputStream of class class java.util.zip.InflaterInputStream is not implementing InputStreamStatistics.
 at org.apache.poi.openxml4j.util.ZipArchiveThresholdInputStream.<init>(ZipArchiveThresholdInputStream.java:65)
 at org.apache.poi.openxml4j.util.ZipSecureFile.getInputStream(ZipSecureFile.java:157)
 at org.apache.poi.openxml4j.util.ZipSecureFile.getInputStream(ZipSecureFile.java:36)
 at org.apache.poi.openxml4j.util.ZipFileZipEntrySource.getInputStream(ZipFileZipEntrySource.java:63)
 at org.apache.poi.openxml4j.opc.ZipPackage.getPartsImpl(ZipPackage.java:282)
 at org.apache.poi.openxml4j.opc.OPCPackage.getParts(OPCPackage.java:743)
 at org.apache.poi.openxml4j.opc.OPCPackage.open(OPCPackage.java:248)
 at org.apache.poi.openxml4j.opc.OPCPackage.open(OPCPackage.java:177)
 at org.apache.poi.openxml4j.opc.OPCPackage.open(POIXMLDocument.java:88)
 at org.apache.poi.xssf.usermodel.XSSFWorkbook.<init>(XSSFWorkbook.java:332).

I have searched for many solutions over Internet regarding this and most of them are highlighting to change the poi and common-compress version to the latest one.

I am already using the latest versions only: i.e. poi-ooxml-5.2.2.jar and commons-compress-1.21.jar but still getting this error. Can someone please suggest more. Is there any version incompatibility or anything?

0

There are 0 best solutions below