使用EasyExcel报错:com.alibaba.excel.exception.ExcelGenerateException: Can not close IO

使用【EasyExcel】报错:com.alibaba.excel.exception.ExcelGenerateException: Can not close IO

首先【EasyExcel】还是挺好用的,推荐一下

链接: 【EasyExcel】.

废话少说,上报错:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
 Root cause of ServletException.
com.alibaba.excel.exception.ExcelGenerateException: Can not close IO
    at com.alibaba.excel.context.WriteContextImpl.throwCanNotCloseIo(WriteContextImpl.java:390)
    at com.alibaba.excel.context.WriteContextImpl.finish(WriteContextImpl.java:352)
    at com.alibaba.excel.write.ExcelBuilderImpl.finish(ExcelBuilderImpl.java:106)
    at com.alibaba.excel.ExcelWriter.finish(ExcelWriter.java:298)
    at com.alibaba.excel.write.builder.ExcelWriterSheetBuilder.doWrite(ExcelWriterSheetBuilder.java:135)
    Truncated. see log file for complete stacktrace
Caused By: java.lang.NoClassDefFoundError: Could not initialize class org.apache.poi.ooxml.POIXMLTypeLoader
    at org.apache.poi.xssf.usermodel.XSSFWorkbook.commit(XSSFWorkbook.java:1770)
    at org.apache.poi.ooxml.POIXMLDocumentPart.onSave(POIXMLDocumentPart.java:463)
    at org.apache.poi.ooxml.POIXMLDocument.write(POIXMLDocument.java:236)
    at org.apache.poi.xssf.streaming.SXSSFWorkbook.write(SXSSFWorkbook.java:933)
    at com.alibaba.excel.context.WriteContextImpl.finish(WriteContextImpl.java:349)
    Truncated. see log file for complete stacktrace
>

其他博主已提供了解决办法:
1.检查:查看poi版本是否冲突
2.检查是否缺少依赖版本
3.检查poi的版本要大于等于3.17版本

这里注意:poi版本已更新到4.X.X,如果高版本还是报错。。。请试一试3.17版本

就这个问题折腾了三天

在这里插入图片描述在这里插入图片描述在这里插入图片描述在这里插入图片描述