Is there a way to invoke compiled .jasper in server?

As from the official documentation (JasperReports-Server-REST-API-Reference.pdf), it was found that a sample report (e.g. CutomersReport) published in jasper server can be invoked by the following restful api,


Question is: is there any way to locate the compiled .jasper file in the report server? (E.G. something like http://somehost:8080/jasperserver/CustomersReport.jasper ???)


mchisty's picture
Joined: Sep 13 2007 - 12:45pm
Last seen: 2 months 6 days ago

Hi M Chisty, why do you need access to the .jasper file on the server? It should be an internal object stored in a temp area of the app server once a report is executed, and not accessible to JRS users.

You could download the JRXML file via REST and then compile it locally.

kkumlien - 4 years 7 months ago

Hi Mate,

Thanks for your feedback.

As you mentioned "You could download the JRXML file via REST and then compile it locally. " ... . That's something I was actually looking for.

Now to answer your question: "why do you need access to the .jasper file on the server? ", I am providing a piece of code below which is currently working properly in our system. We are using iReport5.5 to design/compile reports. The reports (source/binary) are bundled with our EAR file (e.g. /mars-ejb/resources/META-INF/jasper-reports/reports/espl/esl_ej_final_assessment_notice.jrxml and /mars-ejb/resources/META-INF/jasper-reports/reports/espl/esl_ej_final_assessment_notice.jasper).

We have two types of reports:

  1. Type (1): SQL query embedded within reports
  2. Type (2): Java ArrayList is populated and filled in report

We have decided to migrate to TIBCO JasperSoft solutions (with JasperStudio and Jasperreports Server, as because iReport is now deprecated). For this, Type (1) is not a problem. But I do not know how to achieve Type (2) i.e. how do I pass the populated ArrayList objects in .jasper file.

Our current code is like this:

public static byte[] generateJasperPdfReport(String path, Map<String, Object> parameters, List<?> objects) throws Exception {
    if (StringUtils.isBlank(path)) {
        throw new Exception("Report generation path can't be empty");
    if (null == parameters) {
        parameters = new HashMap<>();
    path = "/META-INF/jasper-reports" + path;
    InputStream is = Thread.currentThread().getContextClassLoader().getResourceAsStream(path);
    byte[] bytes = null;
    if (null != objects && !objects.isEmpty()) {
        bytes = JasperRunManager.runReportToPdf(is, parameters, new JRBeanCollectionDataSource(objects));
    } else {
        bytes = JasperRunManager.runReportToPdf(is, parameters);
    return bytes;

When we want to generate a report (PDF byestream), we call our util class like this with passing the jasper file location, required parameters and ArrayList:


List<PslPropertyDetailDTO> properties = ... // Some list of Java DTO objects here
Map<String, Object> parameters = .... // Some parameters provided
// Then invoke the util class
byte fileData[] = ReportUtil.generateJasperPdfReport("/reports/parkingSpaceLevy/psl_modify_property.jasper", parameters, list);

As you can see, if our report is deployed in the jasper server and our EAR/WAR file is deployed another server (JBoss/Tomcat etc), we cannot locate .jasper file path like this "/reports/parkingSpaceLevy/psl_modify_property.jasper".

In such a case, your suggestion about "download the JRXML file via REST and then compile it locally" might be one solution.

Question is: how/where can I locate the jrxml file? Is there any example?


mchisty - 4 years 7 months ago

0 Answers:

No answers yet