0

使用 jaspers exportreport 方法时出现内存错误。堆栈跟踪如下所示。

Exception in thread "main" java.lang.OutOfMemoryError: Java heap space
    at java.text.RuleBasedBreakIterator.readFile(Unknown Source)
    at java.text.RuleBasedBreakIterator.readTables(Unknown Source)
    at java.text.RuleBasedBreakIterator.<init>(Unknown Source)
    at java.text.BreakIterator.createBreakInstance(Unknown Source)
    at java.text.BreakIterator.getBreakInstance(Unknown Source)
    at java.text.BreakIterator.getLineInstance(Unknown Source)
    at java.text.BreakIterator.getLineInstance(Unknown Source)
    at java.awt.font.LineBreakMeasurer.<init>(Unknown Source)
    at net.sf.jasperreports.engine.fill.TextMeasurer.renderParagraph(TextMeasurer.java:655)
    at net.sf.jasperreports.engine.fill.TextMeasurer.measure(TextMeasurer.java:367)
    at net.sf.jasperreports.engine.fill.JRFillTextElement.chopTextElement(JRFillTextElement.java:511)
    at net.sf.jasperreports.engine.fill.JRFillTextField.prepare(JRFillTextField.java:607)
    at net.sf.jasperreports.engine.fill.JRFillElementContainer.prepareElements(JRFillElementContainer.java:328)
    at net.sf.jasperreports.engine.fill.JRFillBand.fill(JRFillBand.java:393)
    at net.sf.jasperreports.engine.fill.JRFillBand.fill(JRFillBand.java:352)
    at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillColumnBand(JRVerticalFiller.java:2023)
    at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillDetail(JRVerticalFiller.java:755)
    at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillReportContent(JRVerticalFiller.java:285)
    at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillReport(JRVerticalFiller.java:132)
    at net.sf.jasperreports.engine.fill.JRBaseFiller.fill(JRBaseFiller.java:836)
    at net.sf.jasperreports.engine.fill.JRBaseFiller.fill(JRBaseFiller.java:765)
    at net.sf.jasperreports.engine.fill.JRFiller.fillReport(JRFiller.java:84)
    at net.sf.jasperreports.engine.JasperFillManager.fillReport(JasperFillManager.java:624)
    at net.sf.jasperreports.engine.JasperFillManager.fillReport(JasperFillManager.java:540)
    at com.aricent.aircell.logpatternanalyzer.report.JasperReportUtils.exportReport(JasperReportUtils.java:86)

我也试过内存泄漏分析器和 jvisualvm 来找出根本原因,但它显示char[]占用超过 90%。如何找出此问题的确切根本原因。

4

3 回答 3

1

似乎 Xmx 设置是问题所在。你应该确保它设置得足够高。如果您怀疑其他任何问题可能是问题所在,您始终可以在运行 oom 时创建一个堆转储并检查是否没有泄漏对象。这可以通过添加两个参数来完成。

-XX:+HeapDumpOnOutOfMemoryError
-XX:HeapDumpPath=/path/to/heapdump

然后您可以使用 jvisualvm 或 Eclipse MAT(内存分析器工具)对其进行分析

于 2013-09-18T13:27:09.167 回答
0

您是否尝试将 Virtualizer 用于填充报告?

http://community.jaspersoft.com/questions/520261/large-report-virtualizer-solution

于 2013-09-20T11:06:41.033 回答
0

您是否尝试过增加堆大小(Xmx)?报告导出可能只需要更多内存。它适用于较小的报告吗?

于 2013-09-18T12:36:55.980 回答