Java JasperReports:通过jsp代码编译报告时从文件加载对象时出错

Java JasperReports:通过jsp代码编译报告时从文件加载对象时出错,java,reporting,jasper-reports,Java,Reporting,Jasper Reports,我已经创建了主报告和子报告。我已经用jsp编写了调用主报告的代码,但它给出了一个错误 Error Loading object from file: "path where the sub report resides". 如果我做错了什么,请帮助我 jasperdesign=jaspermager.loadXmlDesign(getServletConfig()) .getServletContext().getRealPath(“/reports/VoucherReport.jrxml”

我已经创建了主报告和子报告。我已经用jsp编写了调用主报告的代码,但它给出了一个错误

Error Loading object from file: "path where the sub report resides". 
如果我做错了什么,请帮助我

jasperdesign=jaspermager.loadXmlDesign(getServletConfig())
.getServletContext().getRealPath(“/reports/VoucherReport.jrxml”);
jasperReport=jaspecompilemanager.compileReport(jasperdesign);
HashMap=newHashMap();
map.put(“myParam”,voucherId);
jasperPrint=JasperFillManager.fillReport(jasperReport,map,con);
JasperManager.printReportToPdfFile(jasperPrint,getServletConfig()
.getServletContext().getRealPath(“/reports/myReport.pdf”);

它在jasper print上抛出了一个异常。请帮帮我。我需要解决此凭单报表是主报表的问题,我是否也需要编译子报表。

我的web应用程序和子报表的路径也有一些问题。查看*.jrxml文件并检查它是否为子报表使用了绝对路径。对我来说,它帮助我将应用程序的RealPath发送到带有参数的报表。此参数用于子报表的位置