Jump to content
Changes to the Jaspersoft community edition download ×

Report hangs: Java OutOfMemory error on iReport; SQL looping on Jasper Reports Server

Go to solution Solved by KGZ,

Recommended Posts

Hi. I've got a report that only runs intermittently; lately, it's been failing consistently. I've had it hosted on a Jasper Reports Server (v4.0.0), and when it's there, if the server has been rebooted recently, the report may run. But, there seems to be some kind of memory leak I don't know how to track down, and when this condition is met, running the report causes the SQL in one of my sub-datasets to "loop". It's the weirdest thing: the dataset should only run once, yet I can watch the MySQL processes on my warehouse server and see the SQL getting executed again and again and again. Eventually the report times out.

Recently (today) I pulled down the JRXML to my local system to try to diagnose the problem. After removing/replacing the repository references (i.e. for corp. logos, fonts, etc.) I can get the report to compile, yet when I run it in iReport, it just hangs. No excessive CPU usage, just hourglass and no response. It's not even sending the SQL to the DB server, as I've been monitoring that. (For reference, it's iReport 4.0.2 - yeah, don't give me too hard a time - can't upgrade yet due to an error we get integrating newer JRXMLs on another app server).

Really no idea where to go from here. The error I get in iReport (10 minutes later) is:


Error filling print... java.lang.OutOfMemoryError: Java heap space null 
Setting up the file resolver... Added file resolver... Active top component: 2014INT.jrxml /home/tunes/Documents/CCHIT/Reporting/TestReports/2014INT.jrxml java.lang.OutOfMemoryError: Java heap space     at java.util.Arrays.copyOf(Arrays.java:2798)     at java.io.ByteArrayOutputStream.toByteArray(ByteArrayOutputStream.java:150)     at net.sf.jasperreports.engine.util.JRLoader.loadBytes(JRLoader.java:403)     at net.sf.jasperreports.engine.util.JRLoader.loadBytesFromLocation(JRLoader.java:554)     at net.sf.jasperreports.engine.JRImageRenderer.getInstance(JRImageRenderer.java:217)     at net.sf.jasperreports.engine.fill.JRFillImage.evaluateImage(JRFillImage.java:1057)     at net.sf.jasperreports.engine.fill.JRFillImage.evaluate(JRFillImage.java:1004)     at net.sf.jasperreports.engine.fill.JRFillElementContainer.evaluate(JRFillElementContainer.java:258)     at net.sf.jasperreports.engine.fill.JRFillBand.evaluate(JRFillBand.java:499)     at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillBandNoOverflow(JRVerticalFiller.java:439)     at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillPageHeader(JRVerticalFiller.java:403)     at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillSummaryOverflow(JRVerticalFiller.java:1745)     at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillSummaryNoLastFooterNewPage(JRVerticalFiller.java:1208)     at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillSummary(JRVerticalFiller.java:1041)     at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillReportEnd(JRVerticalFiller.java:301)     at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillReport(JRVerticalFiller.java:135)     at net.sf.jasperreports.engine.fill.JRBaseFiller.fill(JRBaseFiller.java:946)     at net.sf.jasperreports.engine.fill.JRBaseFiller.fill(JRBaseFiller.java:845)     at net.sf.jasperreports.engine.fill.JRFiller.fillReport(JRFiller.java:58)     at net.sf.jasperreports.engine.JasperFillManager.fillReport(JasperFillManager.java:417)     at net.sf.jasperreports.engine.JasperFillManager.fillReport(JasperFillManager.java:247)     at com.jaspersoft.ireport.designer.compiler.IReportCompiler.run(IReportCompiler.java:878)     at org.openide.util.RequestProcessor$Task.run(RequestProcessor.java:572)     at org.openide.util.RequestProcessor$Processor.run(RequestProcessor.java:997) 
Print not filled. Try to use an EmptyDataSource...
Any and all suggestions welcome. I can post the JRXML, and even go scrape some of the catalina.out file from my JR Server if someone would review them and offer some suggestions.
Thanks in advance,
Link to comment
Share on other sites

  • Replies 16
  • Created
  • Last Reply

Top Posters In This Topic

<?xml version="1.0" encoding="UTF-8"?>

]]></defaultValueExpression></p><p> </parameter></p><p> <queryString></p><p> <![CDATA[sELECT RIGHT(c.Id,9) AS TestReportNo,</p><p> CASE</p><p> WHEN c.RecordTypeId = '012500000001QD8AAM' THEN 'Inpatient'</p><p> WHEN c.RecordTypeId = '012500000001QD7AAM' THEN 'Ambulatory'</p><p> END AS TestType,</p><p> -- ROLL-UP FROM ALL INSPECTIONS</p><p> GROUP_CONCAT(CONCAT(DATE_FORMAT(i.Completed__c,"%Y-%m-%d"),IF(i.Amendment_to__c<>"","(A)", ""),IF(i.Retest__c=TRUE,"&reg;", "")) ORDER BY i.Completed__c SEPARATOR ", ") AS DateOfTest,</p><p> a.`Name` AS OrgName,</p><p> CASE</p><p> WHEN c.RecordTypeId IN ('012500000001QD8AAM') THEN 'Hospitals'</p><p> WHEN c.RecordTypeId IN ('012500000001QD7AAM') THEN 'Eligible Providers'</p><p> END AS Domain,</p><p> CONCAT(a.BillingStreet,'n',a.BillingCity,', ',a.BillingState,' ',a.BillingPostalCode) AS Address,</p><p> c.Market_Company_URL__c AS Website,</p><p> c.Market_Email__c AS Email,</p><p> c.Market_Phone__c AS Phone,</p><p> c.Product_Name_Tested__c AS ProductName,</p><p> c.Product_Version_Tested__c AS ProductVersion,</p><p> c.Quality_Reports_Passed__c AS NQFs,</p><p> IF((SELECT COUNT(*)</p><p> FROM (salesforce.ehr_component__c e INNER JOIN salesforce.certification__c ec ON e.Certification__c = ec.Id)</p><p> INNER JOIN salesforce.inspection__c ei ON ec.Id = ei.Certification__c</p><p> WHERE ei.Id LIKE CONCAT($P{InspectionId},"%")) > 0,True,False) AS EHRComps,</p><p> IF(LENGTH(GROUP_CONCAT(i.Amendment_to__c SEPARATOR ""))>0,"Amended ","") AS Amended,</p><p> GROUP_CONCAT(CONCAT(DATE_FORMAT(i.Completed__c,"%Y-%m-%d")," ",i.Notes_to_tester__c) ORDER BY i.Completed__c SEPARATOR "n") AS NotesToTester,</p><p> GROUP_CONCAT(CONCAT(DATE_FORMAT(i.Completed__c,"%Y-%m-%d")," ",i.Notes_from_tester__c) ORDER BY i.Completed__c SEPARATOR "n") AS NotesFromTester,</p><p> GROUP_CONCAT(i.QMS__c ORDER BY i.Completed__c SEPARATOR "n") AS QMS,</p><p> GROUP_CONCAT(i.SED__c ORDER BY i.Completed__c SEPARATOR "n") AS SED,</p><p> GROUP_CONCAT(CONCAT(DATE_FORMAT(i.Completed__c,"%Y-%m-%d")," ",i.Deviations__c) ORDER BY i.Completed__c SEPARATOR "n") AS Deviations,</p><p> GROUP_CONCAT(CONCAT(DATE_FORMAT(i.Completed__c,"%Y-%m-%d")," ",i.Optional_Standards_Tested__c) ORDER BY i.Completed__c SEPARATOR "n") AS OptStandards,</p><p> GROUP_CONCAT(CONCAT(DATE_FORMAT(i.Completed__c,"%Y-%m-%d")," ",i.Newer_Standards__c) ORDER BY i.Completed__c SEPARATOR "n") AS NewerStandards,</p><p> IF(c.Complete_EHR__c,"Complete","Modular") AS CompMod</p><p>&nbsp;</p><p> FROM ((salesforce.inspection__c i INNER JOIN salesforce.certification__c c ON i.Certification__c = c.Id)</p><p> INNER JOIN salesforce.account a ON c.Vendor__c = a.Id)</p><p> LEFT JOIN salesforce.inspection__c am ON i.Amendment_to__c = am.Id</p><p> WHERE c.RecordTypeId IN ('012500000001QD8AAM','012500000001QD7AAM')</p><p> AND i.Id IN(SELECT xi.Id FROM</p><p> (salesforce.inspection__c xi INNER JOIN salesforce.certification__c xc ON xi.Certification__c = xc.Id) INNER JOIN</p><p> salesforce.inspection__c yi ON xc.Id = yi.Certification__c</p><p> WHERE yi.Id LIKE CONCAT($P{InspectionId},"%"))</p><p> AND i.Id NOT IN(SELECT zi.Amendment_to__c FROM salesforce.inspection__c zi WHERE NOT zi.Amendment_to__c IS NULL)</p><p> GROUP BY c.Id</p><p> ORDER BY i.Completed__c;

sELECT e.Architecture__c AS Architecture,</p><p> e.Hosting_Model__c AS HostingModel,</p><p> CONCAT(e.Database__c,IF(e.Other_Database__c="",""," - "),e.Other_Database__c) AS DB,</p><p> CONCAT(e.Database_Server_OS__c,IF(e.Other_DB_OS__c="",""," - "),e.Other_DB_OS__c) AS DBOS,</p><p> CONCAT(e.Client_OS__c,IF(e.Other_Client_OS__c="",""," - "),e.Other_Client_OS__c) AS ClientOS,</p><p> CONCAT(e.Browser__c,IF(e.Other_Browser__c="",""," - "),e.Other_Browser__c) AS Browser,</p><p> e.Other_Components__c AS OtherComponents</p><p> FROM salesforce.ehr_configuration__c e INNER JOIN salesforce.inspection__c i USING(Certification__c)</p><p> WHERE i.Id LIKE CONCAT($P{InspectionId},"%") AND e.Tested_Configuration__c = "true";

]]></defaultValueExpression></p><p> </parameter></p><p> <queryString></p><p> <![CDATA[CALL rpt_test_report_sub_ehr_components($P{InspectionId});

]]></defaultValueExpression></p><p> </parameter></p><p> <queryString></p><p> <![CDATA[CALL salesforce.rpt_test_report_sub_cqms($P{InspectionId});


new java.util.Date()

CALL salesforce.rpt_test_report_sub_criteria2014($P{InspectionId});





"The above-named product was tested according to the test procedures for evaluating conformance of EHRs or EHR modules to the certification criteria defined in Health Information Technology: Standards, Implementation Specifications, and Certification Criteria for Electronic Health Record Technology, 2014 Edition as published on September 4, 2012. The specific test procedures (“2014 Edition Test Method”) can be found at <style isUnderline=true" forecolor="blue"><a href='http://www.healthit.gov/policy-researchers-implementers/2014-edition-final-test-method'>http://www.healthit.gov/policy-researchers-implementers/2014-edition-final-test-method</a></style>.<br/><br/>These criteria were tested on this date and the results are as follows:

"<a href='http://www.healthit.gov/policy-researchers-implementers/2014-edition-final-test-method'>http://www.healthit.gov/policy-researchers-implementers/2014-edition-final-test-method</a>"

"Link to 45 CFR Part 170, RIN 0991-AB58"


Applicant Name:



Product Version:

Product Name:


Applicant Address:

Test Report #


Date(s) of Test:




"ONC 2014 Test Report <style forecolor=red">" + $F{Amended} + "</style>

Test Type:


("A"=Amended, "R"=Retest)













$V{REPORT_COUNT}<40 &&</p><p> $V{REPORT_COUNT}%11==0 &&</p><p> $V{REPORT_COUNT}>=11


Version 1.0, January 2, 2013 Copyright © CCHIT



Quality Management Systems



safety Enhanced Design


Notes from Tester


Notes to Tester


The deviations from, additions to, or exclusions from the aforementioned test methods, test conditions and test setup, including the use of applicant-supplied test data, are as follows:

Newer Standards Tested



Optional Standards Tested










Hosting Model:


Database Server OS:

Client OS:


Other Components:


software Configuration Tested



Additional Software Used in Testing

Product Name


Product Version




Criteria this product supports




Clinical Quality Measures Passed



Measure Title


Applicable Criteria


Link to comment
Share on other sites

Sorry, meant to add some niceties: Thanks, KGZ - I hope you do have an answer for us! BTW, tried upping my Xms & Xmx values for iReport to 1024m and 2048m respectively - same error; just took longer to fail. Thanks much -Ben
Link to comment
Share on other sites

  • Solution

Hi Ben,

I can't open your jrxml in iReport but, I had a look to the xml and it seems you have the same problem we had.

I noticed that you use page header band with a hight = 413. Page header is repeated in each page. I think your are using dynamic elements within it.

Your band stretch with your data and when it won't find enough place it will try to go to next page which must contain the page header band !!

I think this is the reason of the loop.

In plus you have a summary band with a hight = 492 and the property isSummaryWithPageHeaderAndFooter="true"

I hope this will help you.


Link to comment
Share on other sites

KGZ - that did the trick. Thanks SO much! I'll have some fine-tuning to do in order to get everything ordered properly, but moving elements out of the repeating page header seemed to solve the problem. I'll implement the Title band, and control what's visible with a few "Print When" expressions; I think I'm good. Thanks again! -Ben
Link to comment
Share on other sites

Thanks KGZ, I dont see this issue in Ireport, I see it in our code, when i click on reports button multiple times the permgen space increases and it comes down very slowly. Data is very small just couple of rows. I am not sure is there any leak happening through my sql query  or infinite loop??? Increasing the permgen space is not a permanent solution.. I am planning to use Visualizer but guess it helps when we have large data.

here is my Jrxml:(I have 2 sub reports in this jrxml) 


Link to comment
Share on other sites

<?xml version="1.0" encoding="UTF-8"?>

"C:\Documents and Settings\akadarmandal\Desktop\WMS_R2.1_Reports\JR\"



sELECT cd.sysDescr,cd.IPAddress</p><p> FROM uwlan.controllerdevice cd</p><p> WHERE</p><p> cd.IPAddress = $P{IPAddress};

new java.util.Date()








WMS - Inventory Report</p><p>

Generated on













Link to comment
Share on other sites

  • 3 weeks later...

More follow-up: this problem occurred AGAIN, and I just could not figure out how to keep the subdataset form re-executing in an endless loop. So, the final solution was to break the report in two:

  1. Master report: query returns just a single row; data placed in elements in title, page header and summary bands
  2. Sub report: query returns ~60 rows; needs to be formatted in four columns

Doing it this way allowed me to remove the list components, which were required when trying to tie elements on the original "master" report to a subdataset.

Happy to provide details to anyone this might help - just add a note to this thread.

Link to comment
Share on other sites

  • 7 years later...

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...