OutOfMemoryError:Win10下的Java堆空间

时间:2018-11-23 05:27:23

标签: java apache-poi heap

有一个桌面应用程序,该应用程序使用apache.poi插入50,000行XLSX文件,并在验证后将其写入数据库以进行报告。

该应用程序已完成,因为所有必需的功能都起作用。在OpenSuse 43.3,KDE,4 x i5-2500CPU,16gig RAM下的盒子上开发。将其打包成一个jar文件,可以看到它在同一Linux和Win 10下在笔记本电脑上运行都没有问题。但是,在Windows 10下在开发箱上运行该文件时,对文件运行验证方法会导致以下错误。

Exception in thread "AWT-EventQueue-0" java.lang.OutOfMemoryError: Java heap space
        at org.apache.xmlbeans.impl.store.Cur$CurLoadContext.attr(Cur.java:3044)
        at org.apache.xmlbeans.impl.store.Locale.loadNode(Locale.java:1440)
        at org.apache.xmlbeans.impl.store.Locale.loadNodeChildren(Locale.java:1403)
        at org.apache.xmlbeans.impl.store.Locale.loadNode(Locale.java:1445)
        at org.apache.xmlbeans.impl.store.Locale.loadNodeChildren(Locale.java:1403)
        at org.apache.xmlbeans.impl.store.Locale.loadNode(Locale.java:1445)
        at org.apache.xmlbeans.impl.store.Locale.loadNodeChildren(Locale.java:1403)
        at org.apache.xmlbeans.impl.store.Locale.loadNode(Locale.java:1445)
        at org.apache.xmlbeans.impl.store.Locale.parseToXmlObject(Locale.java:1385)
        at org.apache.xmlbeans.impl.store.Locale.parseToXmlObject(Locale.java:1370)
        at org.apache.xmlbeans.impl.schema.SchemaTypeLoaderBase.parse(SchemaTypeLoaderBase.java:370)
        at org.apache.poi.POIXMLTypeLoader.parse(POIXMLTypeLoader.java:164)
        at org.openxmlformats.schemas.spreadsheetml.x2006.main.WorksheetDocument$Factory.parse(Unknown Source)
        at org.apache.poi.xssf.usermodel.XSSFSheet.read(XSSFSheet.java:226)
        at org.apache.poi.xssf.usermodel.XSSFSheet.onDocumentRead(XSSFSheet.java:218)
        at org.apache.poi.xssf.usermodel.XSSFWorkbook.parseSheet(XSSFWorkbook.java:443)
        at org.apache.poi.xssf.usermodel.XSSFWorkbook.onDocumentRead(XSSFWorkbook.java:408)
        at org.apache.poi.POIXMLDocument.load(POIXMLDocument.java:169)
        at org.apache.poi.xssf.usermodel.XSSFWorkbook.<init>(XSSFWorkbook.java:300)
        at com.zimpics.eds.app_wa01a.VDate.readFile(VDate.java:97)
        at com.zimpics.eds.app_wa01a.VDate.validate(VDate.java:122)
        at com.zimpics.eds.app_wa01a.GUI.Application.validateFile(Application.java:507)
        at com.zimpics.eds.app_wa01a.GUI.Application.access$600(Application.java:43)
        at com.zimpics.eds.app_wa01a.GUI.Application$5.actionPerformed(Application.java:425)
        at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
        at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source)
        at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)
        at javax.swing.DefaultButtonModel.setPressed(Unknown Source)
        at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(Unknown Source)
        at java.awt.Component.processMouseEvent(Unknown Source)
        at javax.swing.JComponent.processMouseEvent(Unknown Source)
        at java.awt.Component.processEvent(Unknown Source)

我不知道如何解决此问题。有人可以指出我正确的方向吗?

0 个答案:

没有答案