Route error with subreports in other computers

0

In the development of a Java system I used iReport Designer 5.6.0 to generate some reports.

However, I have had a problem with reports that contain subreports. I have a parent report that also contains a subreport that would be the detail, in the preview on my computer it shows up wonderfully and also when compiling it, it also works well when creating the * .jar and using it on my computer, but when copying this to other machines does not find the subreport route, due to this it does not find the subreport.

The question is how can I send the route, the location of the subreport to the parent report.

The two reports are in the same directory as the application.

The error generated in other computers is as follows:

  

net.sf.jasperreports.engine.JRException: Resource not found at: C: \ Users \ SONY \ Documents \ NetBeansProjects \ Project \ src \ Reports \ pageheader.jasper

This route is where it is on my computer.

The error displayed is similar to this:
link

    
asked by Alan Blaymiro Itzep Perez 25.07.2018 в 21:17
source

1 answer

1

When I use subreports (in web projects), in the parent report, in the properties of the subreport I put the property Connection type to $P{REPORT_CONNECTION} and from the code where it is called I do it like this:

ServletContext sc = (ServletContext) FacesContext.getCurrentInstance().getExternalContext().getContext();
String reportePath = "/archivos/rptRequerimiento.jasper";
String subreportePath = sc.getRealPath("/archivos/");
subreportePath += "/";
Map parametros = new HashMap();
parametros.put("idRequerimiento", req.getIdRequerimiento());
parametros.put("SUBREPORT_DIR", subreportePath);
imprimePDF(reportePath, parametros, "reporteRequerimiento");
return null;

From there, I send you the subreport route, as a parameter.

    
answered by 31.07.2018 в 16:12