5
votes

I am trying to pass a list of objects on a subreport for our reports generation but I was getting this error message:

net.sf.jasperreports.engine.JRException: Error loading object from InputStream
net.sf.jasperreports.engine.JRRuntimeException: net.sf.jasperreports.engine.JRException: Error loading object from InputStream
    at net.sf.jasperreports.repo.SerializedObjectPersistenceService.load(SerializedObjectPersistenceService.java:65) ~[jasperreports-5.0.1.jar:5.0.1]
    at net.sf.jasperreports.repo.SerializedReportPersistenceService.load(SerializedReportPersistenceService.java:46) ~[jasperreports-5.0.1.jar:5.0.1]
    at net.sf.jasperreports.repo.DefaultRepositoryService.getResource(DefaultRepositoryService.java:187) ~[jasperreports-5.0.1.jar:5.0.1]
    at net.sf.jasperreports.repo.RepositoryUtil.getResourceFromLocation(RepositoryUtil.java:246) ~[jasperreports-5.0.1.jar:5.0.1]
    at net.sf.jasperreports.repo.RepositoryUtil.getReport(RepositoryUtil.java:208) ~[jasperreports-5.0.1.jar:5.0.1]
    at net.sf.jasperreports.engine.fill.JRFillSubreport.evaluateReport(JRFillSubreport.java:328) ~[jasperreports-5.0.1.jar:5.0.1]
    at net.sf.jasperreports.engine.fill.JRFillSubreport.evaluateSubreport(JRFillSubreport.java:361) ~[jasperreports-5.0.1.jar:5.0.1]
    at net.sf.jasperreports.engine.fill.JRFillSubreport.evaluate(JRFillSubreport.java:286) ~[jasperreports-5.0.1.jar:5.0.1]
    at net.sf.jasperreports.engine.fill.JRFillElementContainer.evaluate(JRFillElementContainer.java:259) ~[jasperreports-5.0.1.jar:5.0.1]
    at net.sf.jasperreports.engine.fill.JRFillBand.evaluate(JRFillBand.java:459) ~[jasperreports-5.0.1.jar:5.0.1]
    at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillColumnBand(JRVerticalFiller.java:2044) ~[jasperreports-5.0.1.jar:5.0.1]
    at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillDetail(JRVerticalFiller.java:778) ~[jasperreports-5.0.1.jar:5.0.1]
    at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillReportStart(JRVerticalFiller.java:288) ~[jasperreports-5.0.1.jar:5.0.1]
    at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillReport(JRVerticalFiller.java:151) ~[jasperreports-5.0.1.jar:5.0.1]
    at net.sf.jasperreports.engine.fill.JRBaseFiller.fill(JRBaseFiller.java:909) ~[jasperreports-5.0.1.jar:5.0.1]
    at net.sf.jasperreports.engine.fill.JRBaseFiller.fill(JRBaseFiller.java:841) ~[jasperreports-5.0.1.jar:5.0.1]
    at net.sf.jasperreports.engine.fill.JRFiller.fill(JRFiller.java:88) ~[jasperreports-5.0.1.jar:5.0.1]
    at net.sf.jasperreports.engine.JasperFillManager.fill(JasperFillManager.java:653) ~[jasperreports-5.0.1.jar:5.0.1]
    at net.sf.jasperreports.engine.JasperFillManager.fillReport(JasperFillManager.java:969) ~[jasperreports-5.0.1.jar:5.0.1]

I tried different tutorials in regards to this matter but I am still getting the same error below is the sample structure of the main object being passed to the main report

    private String headerRecordFormat;
    private String institutionRecordFormat;
    private ArrayList<InstituionDetailFormatTransactions> listOfTransactions;
    private String institutionTrailerRecordFormat;

and this is how I currently declare the arraylist "listOfTransactions" to my main xml and using it on calling the subreport

<field name="listOfTransactions" class="java.util.ArrayList" >
        <fieldDescription><![CDATA[listOfTransactions]]></fieldDescription>
    </field>

                    <subreport>
                    <reportElement x="0" y="15" width="560" height="15">
                    </reportElement>
                    <dataSourceExpression><![CDATA[new net.sf.jasperreports.engine.data.JRBeanCollectionDataSource($F{listOfTransactions})]]></dataSourceExpression>
                    <subreportExpression><![CDATA[$P{SUBREPORT_DIR} + "dpsPgpSubReport.jrxml"]]></subreportExpression>
                </subreport>

The object InstituionDetailFormatTransactions contains only one instance variable which is a type String. Are there any mistakes on my declaration on the xml?

1
Any luck? Am stuck with the same exception.kumareloaded
same here. Have you guys found a bypass ?aurelien974

1 Answers

0
votes

Try to restart your computer.

I spent hours to find what was going on. I did correct, everything should go well. Then, in the next day, I started my machine and it worked!