java.lang.NoClassDefFoundError: org/apache/commons/compress/archivers/zip/ZipFile

一,错误: java.lang.NoClassDefFoundError: org/apache/commons/compress/archivers/zip/ZipFile

实现java代码导入导出Excel表格请参考导入excel代码(https://blog.csdn.net/laterstage/article/details/131713449?spm=1001.2014.3001.5501)

错误原因:缺少对应的commons-compress-1.18.jar,在项目添加该包后问题解决

解决方式:引入jar包

  1. 传统java项目,将commons-compress-1.18.jar添加到依赖里面
  2. maven项目引入下面依赖
  org.apache.commons commons-compress 1.18 

如果以上问题没有解决,将下面pom依赖进行版本对照。

   org.apache.poi poi 4.1.0   org.apache.poi poi-ooxml 4.1.0    org.apache.commons commons-collections4 4.1   org.apache.commons commons-compress 1.18   org.apache.commons commons-math3 3.6.1   org.apache.commons commons-math3 3.6.1   org.apache.poi poi-ooxml-schemas 4.1.2   org.apache.xmlbeans xmlbeans 3.1.0