poi 做数据导出,数据大就会报内存溢出,求解(目前我的数据肯能会在15W笔)

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了poi 做数据导出,数据大就会报内存溢出,求解(目前我的数据肯能会在15W笔)相关的知识,希望对你有一定的参考价值。

java.lang.OutOfMemoryError: Java heap space
at org.apache.poi.poifs.storage.DocumentBlock.<init>(DocumentBlock.java:86)
at org.apache.poi.poifs.storage.DocumentBlock.<init>(DocumentBlock.java:73)
at org.apache.poi.poifs.filesystem.POIFSDocument.<init>(POIFSDocument.java:146)
at org.apache.poi.poifs.filesystem.DirectoryNode.createDocument(DirectoryNode.java:269)
at org.apache.poi.poifs.filesystem.POIFSFileSystem.createDocument(POIFSFileSystem.java:126)
at org.apache.poi.hssf.usermodel.HSSFWorkbook.write(HSSFWorkbook.java:908)
at org.springframework.web.servlet.view.document.AbstractExcelView.renderMergedOutputModel(AbstractExcelView.java:153)
at org.springframework.web.servlet.view.AbstractView.render(AbstractView.java:257)
at org.springframework.web.servlet.DispatcherServlet.render(DispatcherServlet.java:1183)
at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:902)
at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:807)
at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:571)
at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:511)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:647)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:269)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)
at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:96)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:215)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:172)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:117)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:108)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:174)
at org.apache.coyote.http11.Http11AprProcessor.process(Http11AprProcessor.java:843)
at org.apache.coyote.http11.Http11AprProtocol$Http11ConnectionHandler.process(Http11AprProtocol.java:679)
at org.apache.tomcat.util.net.AprEndpoint$Worker.run(AprEndpoint.java:1293)
at java.lang.Thread.run(Thread.java:619)

参考技术A 调整tomcat bin目录下的catalina.bat

set JAVA_OPTS=-Xms64m -Xmx1400m

以上是关于poi 做数据导出,数据大就会报内存溢出,求解(目前我的数据肯能会在15W笔)的主要内容,如果未能解决你的问题,请参考以下文章

poi导出大数据,报内存溢出怎么解决

POI导出数据内存溢出问题

POI实现大数据EXCLE导入导出,解决内存溢出问题

poi导出excel数据多导出慢

POI导出用JDK8正籎DK7就内存溢出,怎么回事

easyexcel合并单元格导出内存溢出