我正在尝试将JasperReports jrxml 模板加载到我的DynamicReport对象,但我得到一个空指针,但不知道它来自哪里。
代码实际上是这样的:
DynamicReport dr = new DynamicReport();
DynamicReportBuilder drb = new DynamicReportBuilder();
......
drb.setTemplateFile("styles/myreport.jrxml");
dr = drb.build();
然后我打电话
JasperPrint jp = DynamicJasperHelper.generateJasperPrint(dr, new ClassicLayoutManager(), resultSetDataSource);
错误是这样的:
java.lang.NullPointerException
at ar.com.fdvs.dj.core.DynamicJasperHelper.generateJasperDesign(DynamicJasperHelper.java:200)
at ar.com.fdvs.dj.core.DynamicJasperHelper.generateJasperReport(DynamicJasperHelper.java:535)
at ar.com.fdvs.dj.core.DynamicJasperHelper.generateJasperReport(DynamicJasperHelper.java:518)
at ar.com.fdvs.dj.core.DynamicJasperHelper.generateJasperPrint(DynamicJasperHelper.java:283)
at ar.com.fdvs.dj.core.DynamicJasperHelper.generateJasperPrint(DynamicJasperHelper.java:236)
有人知道吗?
ps:我正在使用iReport 5(甚至尝试使用 4)和DynamicJasper 3.1.8。