I am trying to load a JasperReports jrxml template to my DynamicReport object but I am getting a null pointer without knowing from where it comes.
The code practically is like this:
DynamicReport dr = new DynamicReport();
DynamicReportBuilder drb = new DynamicReportBuilder();
......
drb.setTemplateFile("styles/myreport.jrxml");
dr = drb.build();
Then I call
JasperPrint jp = DynamicJasperHelper.generateJasperPrint(dr, new ClassicLayoutManager(), resultSetDataSource);
The error is this:
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)
Does anyone has any idea?
ps: I am using iReport 5 (tried even with 4) with DynamicJasper 3.1.8.
DynamicJasper And JasperReport needs to be compatible with each other, i think that's the problem with you.
Please find below compatibilities:
DJ 5.x works with JasperReposrts 4.6+ (and 5.0+, 5.1+ and 5.2) and needs JDK 1.6
DJ 4.x workrs with JasperReports 4.1 to 4.5.x
DJ 3.0.5 works with JR 3.5 up to 4.0
Note: Make sure Your jrxml
is compiled with Jasper
version.