Issue Description
Exception only occurs with a specific parameter input.
The report always shows correctly in browser.
However, if we change the input parameter which then changes the report output, export to PDF generally successful, but at times failed with "No snapshot data found" exception as below.
net.sf.jasperreports.engine.JRRuntimeException: net.sf.jasperreports.data.cache.DataSnapshotException: No snapshot data found for position [{datasetUUID:2598179e-8f26-402f-8d7c-a0d194fbfc2e,queryMD5:7ae5d8b6e1fb354a8d434a70744b6ea2,},{datasetRunUUID:de20dd8a-a122-44a2-9571-c2ef8131ea29,rowIndex:38,datasetUUID:1c4bea0a-0c12-477e-9b0d-b91b248c9e65,queryMD5:fb71252749bfe40aa346e0b7b858359d,}]. at net.sf.jasperreports.components.list.VerticalFillList.prepare(VerticalFillList.java:150) at net.sf.jasperreports.engine.fill.JRFillComponentElement.prepare(JRFillComponentElement.java:152) at net.sf.jasperreports.engine.fill.JRFillElementContainer.prepareElements(JRFillElementContainer.java:542) at net.sf.jasperreports.engine.fill.JRFillBand.fill(JRFillBand.java:411) at net.sf.jasperreports.engine.fill.JRFillBand.fill(JRFillBand.java:386) at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillBandNoOverflow(JRVerticalFiller.java:413) at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillPageHeader(JRVerticalFiller.java:373) at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillPageBreak(JRVerticalFiller.java:2185) at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillColumnBreak(JRVerticalFiller.java:2269) at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillDetail(JRVerticalFiller.java:726) at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillReportContent(JRVerticalFiller.java:260) at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillReport(JRVerticalFiller.java:103) at net.sf.jasperreports.engine.fill.JRBaseFiller.fill(JRBaseFiller.java:607) at net.sf.jasperreports.engine.fill.BaseFillHandle$ReportFill.run(BaseFillHandle.java:123) … …
Resolution
The problem comes from the fact that the datasnapshot is recorded when the report is run in HTML and is not paginated.
In the datasnapshot, JRS keeps not only the data of the master dataset, but also ramifications for all the subdataset instances that have occurred during the report run.
If report has a list component in the page header/footer, which uses a subdatset with a query. As an example, in the non-paginated run (HTML), the header appears only once and JRS registered only an instance of its data. When the report is run paginated (PDF), and the header appears twice with certain parameter inputs (report with at least two pages). The program cannot find any data recorded for the second occurrence of the subdataset. Hence, ended with the exception.
The solution is to either disable snapshots, or refactor the report to eliminate the list component from the page header/footer.
There are two options to disable snapshots for report: -
1. Globally/server-wide, in /WEB-INF/applicationContext-data-snapshots.xml you can set the following to "false" instead of true.
<property name="snapshotRecordingEnabled" value="false"/>
2. The second option, which we recommend, is to disable snapshots for individual report. Set these two properties within JRXML to false.
net.sf.jasperreports.data.cache.recordable=false net.sf.jasperreports.data.cache.persistable=false
Recommended Comments
There are no comments to display.
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 accountSign in
Already have an account? Sign in here.
Sign In Now