Generating dynamic jasper report from tabledatamodel
I am trying to generate a jasper report using a tabledatamodel, as
JRDataSource dataSource = new JRTableModelDataSource(model);
JasperPrint jp = DynamicJasperHelper.generateJasperPrint(dr, new ClassicLayoutManager(), dataSource);
JasperViewer.viewReport(jp);
when I run this code I ge开发者_如何学运维t following error, if anyone can help me to come-up with this problem.
Exception in thread "main" java.lang.NoSuchMethodError: ar.com.fdvs.dj.domain.DynamicJasperDesign.setPrintOrder(B)V at ar.com.fdvs.dj.core.DJJRDesignHelper.getNewDesign(DJJRDesignHelper.java:69) at ar.com.fdvs.dj.core.DynamicJasperHelper.generateJasperDesign(DynamicJasperHelper.java:207) 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)
This has something to do with the jasper reports version you are using, try downgrading. The issue was reported here
The issue is mainly because of jar file mismatches. It depends on which Jasper version you are using with DynamicJasper. On DynamicJasper's download page you will find information about compatibility versions here is summary:
- DJ 5.x works with JasperReposrts 4.6.+
- 5.x and 6.0.x. (JDK 1.6 needed)
- 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
For future updates refer http://dynamicjasper.com/download/ for version compatibility.
精彩评论