日期:2014-05-18  浏览次数:20731 次

iReport报表在发送时报的异常,麻烦帮小弟看看!
我的报表在iReport中生成pdf预览都成功了,Action中有如下代码:

JRBeanCollectionDataSource jrds = new JRBeanCollectionDataSource(list);
String jasperFile = this.getServlet().getServletContext().getRealPath("voting/voter.jasper"); //填充
JasperPrint jasperPrint = JasperFillManager.fillReport(jasperFile, null, jrds);
System.out.println("填充"); //这里都没执行了,抛出异常
//4.导出
System.out.println("导出");
byte[] b = JasperExportManager.exportReportToPdf(jasperPrint);
//5.输出
System.out.println("输出");
ServletOutputStream out = response.getOutputStream();
out.write(b, 0, b.length);
out.close();

页面异常:
javax.servlet.ServletException: cannot assign instance of net.sf.jasperreports.engine.base.JRBaseChart to field net.sf.jasperreports.engine.base.JRBaseLineBox.boxContainer of type net.sf.jasperreports.engine.JRBoxContainer in instance of net.sf.jasperreports.engine.base.JRBaseLineBox

java.lang.ClassCastException: cannot assign instance of net.sf.jasperreports.engine.base.JRBaseChart to field net.sf.jasperreports.engine.base.JRBaseLineBox.boxContainer of type net.sf.jasperreports.engine.JRBoxContainer in instance of net.sf.jasperreports.engine.base.JRBaseLineBox

不知道什么类型不匹配了



------解决方案--------------------
Java code
java.lang.ClassCastException: cannot assign instance of net.sf.jasperreports.engine.base.JRBaseChart to field net.sf.jasperreports.engine.base.JRBaseLineBox.boxContainer of type net.sf.jasperreports.engine.JRBoxContainer in instance of net.sf.jasperreports.engine.base.JRBaseLineBox

------解决方案--------------------
没看懂,不过你可以看看这个 http://www.java2000.net/p262