开发者

JasperReports: Error loading object from file while compiling report through jsp code

开发者 https://www.devze.com 2023-01-06 18:04 出处:网络
I have created a master report and a sub report. I have written the code in jsp to call the master report but it gives an error.

I have created a master report and a sub report. I have written the code in jsp to call the master report but it gives an error.

Error Loading object from file: "path where the sub report resides". 

Please help me out if I am doing something wrong.

jasperdesign = JasperManager.loadXmlDesign(getServletConfig()
        .getServl开发者_如何学编程etContext().getRealPath("/reports/VoucherReport.jrxml"));
jasperReport = JasperCompileManager.compileReport(jasperdesign);

HashMap map = new HashMap();
map.put("myParam", voucherId);

jasperPrint = JasperFillManager.fillReport(jasperReport, map, con);
JasperManager.printReportToPdfFile(jasperPrint, getServletConfig()
        .getServletContext().getRealPath("/reports/myReport.pdf"));

It is throwing an exception on jasper print. Please help me out. I need a solution for this voucher report is a master report, do I also need to compile subreport too.


i had also some problems with my web app and the path for subreports. Look at the *.jrxml file and check if it uses an absolute path for the subreport. For me it helped to send the RealPath of my application to the report with a parameter. This parameter is used for the location of the subreport.

0

精彩评论

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

关注公众号