Jump to content

A system error occurred while running it. Exceptions: java.lang.OutOfMemoryError: Java heap space


Recommended Posts

Hi all,

I have scheduled over 150 report in jasper server and reports fetching data from mongodb. Scheduler runs every day and required to run within 2 hours,i am collecting over 40 millions records every day in mongodb and report fetching data from mongodb.

I am getting Heap space memory error at the time of scheduler runs

Error Message: The job was not completed. A system error occurred while running it. Exceptions: java.lang.OutOfMemoryError: Java heap space

For this issue i have set following parameter in apache tomcat setenv.sh

JAVA_OPTS="-Xms25g -Xmx35g -XX:PermSize=10g -XX:MaxPermSize=20g -Xss2m -XX:+UseConcMarkSweepGC -XX:+CMSClassUnloadingEnabled $JAVA_OPTS "

For some report scheduler runs but report not generated




Link to comment
Share on other sites

  • Replies 6
  • Created
  • Last Reply

Top Posters In This Topic

@Hozawa - What is the method to find the memory required per report. How do we find out - are there any commands or logs to figure this out?

Also, this problem does not manifest itself everytime we run reports. This only happens after a few days of execution ... what is the methodolgy to investigate such an issue?


Link to comment
Share on other sites

From the Tomcat Manager, check if Tomcat is really allocated the memory you've set.

If you're getting out of memory after few days, there may be a memory leak. It may be better to restart tomcat every night before the scheduled reports are executed.

Link to comment
Share on other sites

  • 1 year later...

Hello. I am having similar issue with Jasper Report Server - java.lang.OutOfMemoryError: Java heap space, on upgrading to Jasper Report 6.5.1.This is making the application completely unresponsive.

The issue occurs at multiple locations and logs provided below. I have set the JVM Heap space to 8GB, but still does not help. Please let me know if you have any solutions. Thanks in advance.

java.lang.OutOfMemoryError: Java heap space
at java.util.Arrays.copyOf(Arrays.java:2786)
at java.io.ByteArrayOutputStream.write(ByteArrayOutputStream.java:94)
at sun.nio.cs.StreamEncoder.writeBytes(StreamEncoder.java:202)
at sun.nio.cs.StreamEncoder.implWrite(StreamEncoder.java:263)
at sun.nio.cs.StreamEncoder.write(StreamEncoder.java:106)
at sun.nio.cs.StreamEncoder.write(StreamEncoder.java:116)
at java.io.OutputStreamWriter.write(OutputStreamWriter.java:203)
at java.io.Writer.write(Writer.java:140)
at net.sf.jasperreports.engine.export.JRHtmlExporter.exportText(JRHtmlExporter.java:1224)
at net.sf.jasperreports.engine.export.JRHtmlExporter.exportGrid(JRHtmlExporter.java:815)
at net.sf.jasperreports.engine.export.JRHtmlExporter.exportPage(JRHtmlExporter.java:730)
at net.sf.jasperreports.engine.export.JRHtmlExporter.exportReportToWriter(JRHtmlExporter.java:679)
at net.sf.jasperreports.engine.export.JRHtmlExporter.exportReport(JRHtmlExporter.java:389)

JBWEB000236: Servlet.service() for servlet STVPdfServlet threw exception: java.lang.OutOfMemoryError
    at java.io.ByteArrayOutputStream.hugeCapacity(ByteArrayOutputStream.java:123) [rt.jar:1.7.0_201]
    at java.io.ByteArrayOutputStream.grow(ByteArrayOutputStream.java:117) [rt.jar:1.7.0_201]
    at java.io.ByteArrayOutputStream.ensureCapacity(ByteArrayOutputStream.java:93) [rt.jar:1.7.0_201]
    at java.io.ByteArrayOutputStream.write(ByteArrayOutputStream.java:153) [rt.jar:1.7.0_201]
    at java.io.BufferedOutputStream.flushBuffer(BufferedOutputStream.java:82) [rt.jar:1.7.0_201]

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Create New...