org.apache.commons.compress.archivers.zip.ZipFile$1 类的 flink InputStream 未实现 InputStreamStatistics

2023-12-10

我试图将 Excel 加载到 Flink 程序中的 POI 工作簿中。有这样的错误。

引起原因:java.lang.IllegalArgumentException:类org.apache.commons.compress.archivers.zip.ZipFile$1 的InputStream 未实现InputStreamStatistics。 在 org.apache.poi.openxml4j.util.ZipArchiveThresholdInputStream.(ZipArchiveThresholdInputStream.java:63) 在 org.apache.poi.openxml4j.util.ZipSecureFile.getInputStream(ZipSecureFile.java:147) 在 org.apache.poi.openxml4j.util.ZipSecureFile.getInputStream(ZipSecureFile.java:34) 在 org.apache.poi.openxml4j.util.ZipFileZipEntrySource.getInputStream(ZipFileZipEntrySource.java:66) 在 org.apache.poi.openxml4j.opc.ZipPackage.getPartsImpl(ZipPackage.java:258) 在 org.apache.poi.openxml4j.opc.OPCPackage.getParts(OPCPackage.java:725) 在 org.apache.poi.openxml4j.opc.OPCPackage.open(OPCPackage.java:275) 在 org.apache.poi.openxml4j.opc.OPCPackage.open(OPCPackage.java:181) 在 org.apache.poi.xssf.usermodel.XSSFWorkbook。(XSSFWorkbook.java:323)

注意一个测试https://github.com/apache/poi/blob/f509d1deae86866ed531f10f2eba7db17e098473/src/ooxml/testcases/org/apache/poi/openxml4j/util/TestZipSecureFile.java这里提到这一点。但如何解决它。谢谢!


您必须包含较新版本的 commons-compress 并对其进行着色(Maven、Gradle、SBT 中有不同的插件)。或者,您可以使用具有原生 Flink 支持的 HadoopOffice 库来读取/写入 Excel 文件(https://github.com/zuinnote/hadoopoffice/wiki)并且它有一个关于如何正确遮蔽依赖关系的示例(请参阅https://github.com/ZuInnoTe/hadoopoffice/wiki/Using-Apache-Flink-to-read-write-Excel-documents)

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

org.apache.commons.compress.archivers.zip.ZipFile$1 类的 flink InputStream 未实现 InputStreamStatistics 的相关文章

随机推荐