Hi Experts,
I am using iReport with JasperReports 1.3.4.
A master report contains two subreports, one of which has a subreport. All .jasper
files are in the same directory.
iReport generated a SUBREPORT_DIR
parameter. The subreportExpression
gives the subreport filename as ![CDATA[$P{SUBREPORT_DIR} + "subreport.jasper"]
.
Everything works when run within iReport.
The Java web application to generate reports receives a SUBREPORT_DIR
parameter by calling JasperFillManager.fillReport(String sourceFileName, Map parameters, JRBeanCollectionDatasource)
. The SUBREPORT_DIR
is set to the master report's directory.
The fillReport
method throws an exception:
net.sf.jasperreports.engine.JRException: Could not load object from location : .sub-subreport.jasper.
The first subreport seems to process its subreport(embedded subreport), but SUBREPORT_DIR
is not being used to generate the name of the sub-subreport.
What am I missing? How should this scenario be handled?
Thank you.
Update
In the Java class:
filepath = request.getSession(true).getServletContext().getRealPath("/jsps/jrxmls/");
param.put("SUBREPORT_DIR",filepath);
If I change it to the empty string (""
). then it will pass null value right?
My report structure is like:
MasterReport -> Subreport1 -> Sub-Subreport1
The problem is not able to load "Sub-Subreport1".