How to deploy Reports from development to production environment.

This article is intended as a guide to define, within a large organization, how to develop, test and publish reports of JasperReports in different JasperReports Server environments (development, pre-production, production).

Reviewing the material published by JasperSoft in this regard, we find the tutorial "Driving Reports from Development to Production Tutorial" at the following address:


It details how to export and import reports using js-export and js-import in different environments. However, as we move forward in the tutorial we see that for the process to be successful appears some problems: we must hand-edit some XML files and it is not treated properly the problem of creating and using datasources, both the development of the reports themselves and once installed on the JasperReports Server, this hinders the proper security and passwords management (reports developers must not know the passwords of preproduction and production environments, and these should not appear in any way in the ZIP file with the reports that are delivered to the Systems Department for deployment).

This post exposes how to circumvent these problems so that the transition from developmentto production environment is done in the most simple, effective and safe way.

Usually in a large organization there are three environments: development, preproduction and production, where developers (working in the Development Department) create reports from databases and test servers (those who passwords are known by developers). However, servers and preproduction and production databasesare controlled by the Systems Department (responsible of applications deployment) that manages the credentials for access to these environments because of security considerations. The developers only have access to pre-production environment to execute test plans to verify that the reports are working properly, and in no case they have grants to access to production environment (since the pre-production environment is a clone production environment and suitable for testing). The production environment is usually a cluster of servers (JasperReports Server) prepared to respond to a major workload.

The following outline describes this scenario:



Where each node JasperReports Server has its own internal database (MySQL or Postgres, based on the settings and version of JasperReports Server, 3.X or 4.X). Application reports access external databases that can be Postgres, Oracle,…

On the other hand, is very important for the organization to define a standardized way to create packages or lots of application reports specifying, among other things, how to organize the reports, subreports, resources and images in folders. This standardization will greatly facilitate the maintenance of application reports.

At this point we suggest adopt a similar structure to that defined by the open source tool JDeploy, that can be found in:



JDeploy tool allows us to perform operations on a JasperReports Server from the command line (batch deploy reports, create datasources, …).

JDeploy suggests grouping all application reports on a ZIP file according to the following structure:


Where reports and internationalization files are in the root directory. Specific application subreports are located in the subfolder "subreports", and shared subreports, that are used by more than one report of the root folder, are located in "subinformescomp". Specific images of each report are located in "imaxes", the reports shared images  are located in "imaxescomp" directory. The names of these directories are parameterized so that the tool allows us to change them according to our needs. During reports deployment, JDeploy clone in the server the ZIP folder structure, creating the necessary directories on the server.

That said, the steps to be followed in a typical process of development and deployment of reports are:

1.       Development of reports: for this we use the familiar JasperSoft iReport tool. Reports should be developed using DataSources whose name should be consistent in all three environments (development, preproduction and production), although their definition is independent (access credentials, at pointed databases, etc). The folder structure where we keep the reports, pictures, resources, , should be the specified above.

2.       Reports ZIP file creation: after develop the reports, we must repackage them into a ZIP file with the standard structure, which in practice boils down to compress the folder with the reports and give an appropriate name.

3.       Reports ZIP file deployment: to deploy reports in development, preproduction and production environments, the developer only has to forward the ZIP packet to deployment responsible that using the deploy command (deploy.sh) ,deploy the reports ZIP file on each server. Obviously, for the reports work, the deployment responsible, must create the appropiate JasperReports datasources using the command provided by JDeploy (createds.sh), indicating the specific environment credentials. That’s all!.

As seen, although the reports deployment is very simple, nice software development practices advised that the reports must be deployed primarily in the development environment, where developers usually have permission to create datasources and deploy reports directly, and can test their reports before validate them. After this, developers can request a  publication on preproduction environment.

To create the datasources you must use the command createds of JDeploy. An example use of this command is:

./createds.sh catalogo1DS -rd /datasources -drv oracle.jdbc.OracleDriver- url

jdbc:oracle:thin:@ -dsusr root -dspwd root -tjdbc

–h localhost:8081


Where the parameters used represent the following information:



After creating the datasource we can deploy the batch reporting (ZIP file) using the deploy command of JDeploy. An example of using this command is:


./deploy.sh /opt/api/zip/catalogo1.zip -rd /aplicacion1-ds catalogo1DS -h



Where the parameters used represent the following information:


The correct result of this operation will display the batch of reports in the specified location with the directory structure defined above. You can view the changes by using the list command or the JasperReports Server Management Console.

If we use list (see usermanual JDeploy), we get a listlike the following:


We can observe the same data at the JasperReports Server management console.



After a successful execution of the reports test plan on the development environment, the developer shall send the ZIP with the batch of reports to the systems department that perform this same process of deployment in the pre-production environment. And after the successful execution of the test plan in the pre-production environment, the IT department can finally deploy the reports using this same process in the production environment.

In this article we have seen how effectively deploy a Jasper Reports reports in different development environments, preproduction and production, and all thanks to a useful tool as JDeploy. In future articles we will explain how to properly monitor and manage a production environment JasperReports server.


No hay ningún comentario

Añadir un Comentario: