gpt4 book ai didi

jasper-reports - 如何解决 jasper 报告中的这个 nullPointer 异常?

转载 作者:行者123 更新时间:2023-12-04 04:31:11 24 4
gpt4 key购买 nike

我是 jasper 报告的新手,我需要使用 BeanDatasource 和子报告创建 pdf 文档。我引用了以下博客“http://knol.google.com/k/jasper-reports-working-with-beans-and-sub-report#”。我完美地遵循了所有步骤。当我使用 IReport 运行报告时,我可以获得包含内容的 pdf 文档。但是当我们尝试从 java 程序创建时,我在以下行中遇到异常

第 110 行:"JasperFillManager.fillReportToFile("C:/JasperReports/contacts.jasper", parameters, new JRBeanCollectionDataSource(TestPerson.getBeanCollection())); "

这是我在 Eclipse 控制台窗口中遇到的以下错误。

java.lang.NullPointerException at net.sf.jasperreports.engine.JRPropertiesMap.readObject(JRPropertiesMap.java:185) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at java.io.ObjectStreamClass.invokeReadObject(Unknown Source) at java.io.ObjectInputStream.readSerialData(Unknown Source) at java.io.ObjectInputStream.readOrdinaryObject(Unknown Source) at java.io.ObjectInputStream.readObject0(Unknown Source) at java.io.ObjectInputStream.defaultReadFields(Unknown Source) at java.io.ObjectInputStream.readSerialData(Unknown Source) at java.io.ObjectInputStream.readOrdinaryObject(Unknown Source) at java.io.ObjectInputStream.readObject0(Unknown Source) at java.io.ObjectInputStream.readArray(Unknown Source) at java.io.ObjectInputStream.readObject0(Unknown Source) at java.io.ObjectInputStream.defaultReadFields(Unknown Source) at java.io.ObjectInputStream.readSerialData(Unknown Source) at java.io.ObjectInputStream.readOrdinaryObject(Unknown Source) at java.io.ObjectInputStream.readObject0(Unknown Source) at java.io.ObjectInputStream.defaultReadFields(Unknown Source) at java.io.ObjectInputStream.readSerialData(Unknown Source) at java.io.ObjectInputStream.readOrdinaryObject(Unknown Source) at java.io.ObjectInputStream.readObject0(Unknown Source) at java.io.ObjectInputStream.readObject(Unknown Source) at net.sf.jasperreports.engine.util.JRLoader.loadObject(JRLoader.java:88) at net.sf.jasperreports.engine.util.JRLoader.loadObjectFromLocation(JRLoader.java:257) at net.sf.jasperreports.engine.fill.JRFillSubreport.evaluateSubreport(JRFillSubreport.java:308) at net.sf.jasperreports.engine.fill.JRFillSubreport.evaluate(JRFillSubreport.java:257) at net.sf.jasperreports.engine.fill.JRFillElementContainer.evaluate(JRFillElementContainer.java:275) at net.sf.jasperreports.engine.fill.JRFillBand.evaluate(JRFillBand.java:426) at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillColumnBand(JRVerticalFiller.java:1380) at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillDetail(JRVerticalFiller.java:692) at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillReportStart(JRVerticalFiller.java:255) at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillReport(JRVerticalFiller.java:113) at net.sf.jasperreports.engine.fill.JRBaseFiller.fill(JRBaseFiller.java:891) at net.sf.jasperreports.engine.fill.JRBaseFiller.fill(JRBaseFiller.java:814) at net.sf.jasperreports.engine.fill.JRFiller.fillReport(JRFiller.java:89) at net.sf.jasperreports.engine.JasperFillManager.fillReport(JasperFillManager.java:601) at test.TestJasperReport.main(TestJasperReport.java:110)

最佳答案

我遇到了类似的问题,发现 iReports 进行了自动更新,并且它生成的文件不再与我的应用程序构建中引入的 Jasper 版本兼容。

我通过确保我已下载最新的 iReports 和最新的 Jasper Reports 解决了这个问题。

iReport v3.7.4 和 Jasper Reports v3.7.4。

关于jasper-reports - 如何解决 jasper 报告中的这个 nullPointer 异常?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2521875/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com