flink inputstream未实现inputstreamstatistics

v9tzhpje  于 2021-06-21  发布在  Flink
关注(0)|答案(1)|浏览(412)

我试图在flink程序中将excel加载到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.getpartsimp(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。java:323)
注意一个测试https://github.com/apache/poi/blob/f509d1deae86866ed531f10f2eba7db17e098473/src/ooxml/testcases/org/apache/poi/openxml4j/util/testzipsecurefile.java 这里提到这个。但如何解决它。谢谢!

mwg9r5ms

mwg9r5ms1#

您必须包含一个更新版本的commons压缩和着色(maven、gradle和sbt中有不同的插件)。或者,您可以使用hadoopoffice库来读/写excel文件,hadoopoffice库具有原生的flink支持(https://github.com/zuinnote/hadoopoffice/wiki)它还提供了一个如何正确隐藏依赖关系的示例(请参见https://github.com/zuinnote/hadoopoffice/wiki/using-apache-flink-to-read-write-excel-documents)

相关问题