使用POI导出Excel出现The part /docProps/core.xml failed to be saved in the stream XXX异常
使用POI导出Excel出现The part /docProps/core.xml failed to be saved in the stream XXX异常
·
项目场景:
使用POI导出excel。
问题描述
在使用POI导出excel时,当excel内容过多时出现以下Error:
ERROR: 'java.io.IOException: 你的主机中的软件中止了一个已建立的连接。'
出现以下异常:
The part /docProps/core.xml failed to be saved in the stream with marshaller org.apache.poi.openxml4
原因分析:
导出道Excel的内容过多,导致一个IO连接太长被Tomcat强制关闭,从而使POI导出失败。
解决方案:
- 方案一:设置服务器响应时长(不建议)。
- 方案二:使用多线程优化程序。
更多推荐
所有评论(0)