开发者

JasperReports: filling a report throws an exception "Class not found when loading object from file"

I'm using the latest JDK and JasperReports. The reports are designed and compiled with iReport (4.02). Compiled reports are deployed to Eclipse project which is integrated with a Tomcat installation on Windows.

The problem is that calling 开发者_如何学GoJasperFillManager.fillReport(String sourceFileName, Map params, Connection connection), with correct parameters in place, will cause an exception with a message "net.sf.jasperreports.engine.JRException: Class not found when loading object from file".

I've debugged the code and all parameters have valid values. Also the reports work fine when previewed in iReport. I've copied all jar files from the Jasper project lib dir to my Web App Libraries.

The code is divided in multiple places in the actual code but the significant parts are below:

JasperPrint print = JasperFillManager.fillReport(templatePath, params, conn);
byte[] output = null;
try {
    output = JasperExportManager.exportReportToPdf(print);
} catch (JRException e) {
    // TODO Auto-generated catch block
    e.printStackTrace();
}
return output;


Problem solved.

The issue was caused by iReport Designer. I had defined some color formatting by selecting from available predefined color list instead of the the color wheel. This cause the reports to use variables from NetBeans jars instead of using color values.


I used jasperreports-6.17.0.jar and the issue is solved. Old versions created issue.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜