Getting error with Apache POI which is not able to read file passed using FileInputStream

别来无恙 提交于 2019-12-11 00:49:08

问题


While executing below code,

FileInputStream fis = new FileInputStream("C:\\Users\\deepa\\Downloads\\TestDocument.xlsx");
        XSSFWorkbook workbook = new XSSFWorkbook(fis);

I am getting error as

InputStream of class class org.apache.commons.compress.archivers.zip.ZipArchiveInputStream is not implementing InputStreamStatistics.

I have included all the apace poi jar files and common -compress jar file. Please help.


回答1:


Not a java expert of any sorts, but I use Selenium for test automation and was also getting this error. Somehow I found a solution:

  1. Open the .classpath file with a file editor.
  2. Cut your classpathentry that contains commons-compress-1.18.jar and paste it at the beginning below classpathentry kind="con"path="org.testng.TESTNG_CONTAINER"
  3. Save and retry your program.

It solved my problem. Sorry I can't explain why (I am not a real programmer).



来源:https://stackoverflow.com/questions/52577367/getting-error-with-apache-poi-which-is-not-able-to-read-file-passed-using-filein

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!