我正在尝试在子报表上传递对象列表以生成报表但是我收到此错误消息:
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]
我尝试了不同的教程,但我仍然得到同样的错误,下面是传递给主报告的主要对象的样本结构
private String headerRecordFormat;
private String institutionRecordFormat;
private ArrayList<InstituionDetailFormatTransactions> listOfTransactions;
private String institutionTrailerRecordFormat;
这就是我目前如何向我的主xml声明arraylist“listOfTransactions”并在调用子报告时使用它
<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>
对象InstituionDetailFormatTransactions只包含一个类型为String的实例变量。我在xml上的声明是否有任何错误?