santro
santro

Reputation: 393

java.lang.OutOfMemoryError: Java heap space:Trying to use jasper exportreport method

Getting memory out of error while using jaspers exportreport method. The stack trace is given below.

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)

Also I have tried memory leak analyser and as well as jvisualvm to find out the root cause, but it shows char[] occupying more than 90%. how to find out the exact root cause of this problem.

Upvotes: 0

Views: 4085

Answers (3)

sanBez
sanBez

Reputation: 933

Are you try to use Virtualizer for fillReport?

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

Upvotes: 0

AppX
AppX

Reputation: 528

Seems like the Xmx settings is the problem. You should make sure that it's set high enough. If you suspect that anything else might be the problem you can always create a heapdump when you run oom and check that there is no leaking objects. This can be done by adding two parameters.

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

You can then analyze it with jvisualvm or Eclipse MAT (Memory Analyzer Tool)

Upvotes: 1

Andras
Andras

Reputation: 128

Have you tried to increase the heap size (Xmx)? It could happen that the report export simply need more memory. Is it working for smaller reports?

Upvotes: 0

Related Questions