Apache POI出现错误,该POI无法读取使用FileInputStream传递的文件 [英] Getting error with Apache POI which is not able to read file passed using FileInputStream

查看:1809
本文介绍了Apache POI出现错误,该POI无法读取使用FileInputStream传递的文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在执行以下代码时,

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

我收到错误消息

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

我已经包含了所有的apace poi jar文件和通用的-compress jar文件. 请帮忙.

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

推荐答案

不是任何形式的Java专家,但我使用Selenium进行测试自动化,并且也遇到了此错误.我以某种方式找到了解决方案:

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. 使用文件编辑器打开.classpath文件.
  2. 剪切包含commons-compress-1.18.jar的类路径并将其粘贴在classpathentry kind="con"path="org.testng.TESTNG_CONTAINER"
  3. 下方的开头处
  4. 保存并重试您的程序.
  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).

这篇关于Apache POI出现错误,该POI无法读取使用FileInputStream传递的文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆