Overview
In this section we will perform several procedures with jasper reports and observer several situations.
Export/Import
Requirements
Before we start, be sure to install ANT package:
Install ANT
[root@TainBITestnewTrial ~]# yum install ant Last metadata expiration check: 0:52:58 ago on Fri 23 Apr 2021 08:38:07 AM UTC. Dependencies resolved. ============================================================================================================================== Package Arch Version Repository Size ============================================================================================================================== Installing: ant noarch 1.10.5-1.module+el8+2438+c99a8a1e rhel-8-for-x86_64-appstream-eus-rhui-rpms 193 k Installing dependencies: ant-lib noarch 1.10.5-1.module+el8+2438+c99a8a1e rhel-8-for-x86_64-appstream-eus-rhui-rpms 2.0 M copy-jdk-configs noarch 3.7-1.el8 rhel-8-for-x86_64-appstream-eus-rhui-rpms 27 k giflib x86_64 5.1.4-3.el8 rhel-8-for-x86_64-appstream-eus-rhui-rpms 51 k java-1.8.0-openjdk x86_64 1:1.8.0.292.b10-0.el8_2 rhel-8-for-x86_64-appstream-eus-rhui-rpms 328 k java-1.8.0-openjdk-devel x86_64 1:1.8.0.292.b10-0.el8_2 rhel-8-for-x86_64-appstream-eus-rhui-rpms 9.8 M java-1.8.0-openjdk-headless x86_64 1:1.8.0.292.b10-0.el8_2 rhel-8-for-x86_64-appstream-eus-rhui-rpms 34 M javapackages-filesystem noarch 5.3.0-1.module+el8+2447+6f56d9a6 rhel-8-for-x86_64-appstream-eus-rhui-rpms 30 k javapackages-tools noarch 5.3.0-1.module+el8+2447+6f56d9a6 rhel-8-for-x86_64-appstream-eus-rhui-rpms 44 k libfontenc x86_64 1.1.3-8.el8 rhel-8-for-x86_64-app
Otherwise, you will recieve the following error:
Without ANT
[root@TainBITestnewTrial ~]# /opt/jasperreports-server-7.9.0/buildomatic/js-export.sh --everything --output-zip jasperReports.zip WARNING: No bundled Ant found (../apache-ant or ../../apache-ant). Using system Ant /opt/jasperreports-server-7.9.0/buildomatic/js-ant: line 41: ant: command not found
And be sure to run the command from the script's location (e.g. /opt/jasperreports-server-7.9.0/buildomatic/ in my case)
Sometimes, when we migrate a jasper server, we will want to export our reports and schedules. To do that, we can use either:
- Web interface
- Command line
Let's do it with Command Line:
Export From 7.5
From 7.5, we have to include secret key, keyalias and keypass, if we wish to migrate data between Jasper Servers:
We can export all content as follows:
Export
[root@TainBITestnewTrial buildomatic]# ./js-export.sh --genkey --keyalias mycustkey --keypass "mykeypw2" --everything --output-zip jasperReports.zip Execute failed: java.io.IOException: Cannot run program "git": error=2, No such file or directory Validating JasperServer database connection at jdbc:postgresql://127.0.0.1:5432/jasperserver. Phase: [import-export-test] Connection OK Keystore OK VALIDATION COMPLETED Total time: 6 seconds Executing Pro version Using Bundled version of Java First resource path: /opt/jasperreports-server-7.9.0/buildomatic/conf_source/iePro Loading configuration resources Initialization complete Processing started Exporting tenant organizations (/) Exporting tenant organization_1 (/organization_1) Exporting user anonymousUser Exporting user superuser Exporting user jasperadmin of tenant organization_1 Exporting user joeuser of tenant organization_1 Exporting user CaliforniaUser of tenant organization_1 Exporting user demo of tenant organization_1 Exporting role ROLE_ADMINISTRATOR Exporting role ROLE_USER Exporting role ROLE_ANONYMOUS **************************************************************************** Exported 1 job(s) for the /organizations/organization_1/reports/MontlyReport/Monthly_Provider_Summary report unit Secret Key: 0x9e 0xa3 0xfb 0x13 0xf9 0x4a 0xa0 0x6f 0x6f 0x81 0x0b 0xa9 0x6e 0x57 0xce 0x9d Key Alias (UUID): 84a99969-16e0-47ce-818f-b99caef11003 Done
That command will export all the content: roles, reports, users, etc. and it will generate also secret key and key alias, which you need to use during the import:
Now to import it back, use the following command:
Import
[root@TainJasperBI buildomatic]# ./js-import.sh --input-zip /home/andonovj/jasperReports.zip --secret-key "0x9e 0xa3 0xfb 0x13 0xf9 0x4a 0xa0 0x6f 0x6f 0x81 0x0b 0xa9 0x6e 0x57 0xce 0x9d" Execute failed: java.io.IOException: Cannot run program "git": error=2, No such file or directory Validating JasperServer database connection at jdbc:postgresql://127.0.0.1:5432/jasperserver. Phase: [import-export-test] Connection OK Keystore OK VALIDATION COMPLETED Total time: 6 seconds Executing Pro version Using Bundled version of Java First resource path: /opt/jasperreports-server-7.9.0/buildomatic/conf_source/iePro Loading configuration resources Initialization complete Processing started
Both of these scripts are located at:
Windows:
<js-install>\buildomatic\js-import.bat
<js-install>\buildomatic\js-export.bat
Linux:
<js-install>/buildomatic/js-import.sh
<js-install>/buildomatic/js-export.sh