Migrating JasperReports Reports to JasperReports 7
This migration is required for existing JasperReports reports created with JasperReports 6.x when upgrading to Cadenza 11.1 or any later Cadenza version that includes JasperReports 7. Reports compiled with JasperReports 6.x are incompatible with JasperReports 7.x and must be migrated before they can be used in Cadenza.
This migration affects existing JasperReports reports only. Data adapters, filter settings, and other configuration transferred to the report remain unchanged.
Prerequisites
-
Create a backup of the database containing the Cadenza repositories.
-
Install Jaspersoft Studio 7.x.
-
Make sure that all referenced subreports are available. Subreports must be migrated together with the main report.
Migrating the Reports
-
In Cadenza, export the JasperReports reports from the corresponding data view using the export function in the Cadenza Designer on the Data tab.
-
Extract the exported ZIP archive.
-
In Jaspersoft Studio, open the folder containing the extracted report files.
-
Right-click the folder and select JasperReports > Upgrade JasperReports Files.
All files in the folder are updated in one operation.
-
In all
.jrxmlfiles, including subreports, remove every<property>element used for PDF accessibility tagging, includingnet.sf.jasperreports.export.pdf.taggedand properties whose names start withnet.sf.jasperreports.export.pdf.tag.. PDF accessibility tags are no longer supported in Cadenza with this update and cause an error if they are still present. Also removenet.sf.jasperreports.export.pdf.tagger.factory, which is no longer configurable in Cadenza. See Removing PDF Accessibility Tags for concrete examples. -
If the main report references subreports as
.jasperfiles, recompile the migrated subreports to.jasperformat.We recommend using
.jrxmlfiles for subreports instead. Cadenza compiles these files automatically when the report is displayed. -
Compress the updated report files into a ZIP archive.
-
In Cadenza, import the ZIP archive into the corresponding data view with a JasperReports report. Use the import function in the Cadenza Designer on the Data tab.
-
Open the data view and run the report to verify that it is displayed correctly.
Troubleshooting
After migration, some reports may still exhibit compatibility issues. Check the following known causes.
Removing PDF Accessibility Tags
Remove every <property> element named net.sf.jasperreports.export.pdf.tagged or starting with net.sf.jasperreports.export.pdf.tag. from all .jrxml files, including subreports, regardless of its value.
For example:
<property name="net.sf.jasperreports.export.pdf.tagged" value="true"/>
<property name="net.sf.jasperreports.export.pdf.tag.language" value="en-US"/>
<property name="net.sf.jasperreports.export.pdf.tag.h1" value="full"/>
<property name="net.sf.jasperreports.export.pdf.tag.h2" value="full"/>
<property name="net.sf.jasperreports.export.pdf.tag.h3" value="full"/>
<property name="net.sf.jasperreports.export.pdf.tag.table" value="start"/>
<property name="net.sf.jasperreports.export.pdf.tag.tr" value="start"/>
<property name="net.sf.jasperreports.export.pdf.tag.th" value="full"/>
<property name="net.sf.jasperreports.export.pdf.tag.td" value="full"/>
<property name="net.sf.jasperreports.export.pdf.tag.colspan" value="2"/>
<property name="net.sf.jasperreports.export.pdf.tag.rowspan" value="2"/>
<property name="net.sf.jasperreports.export.pdf.tag.tr" value="end"/>
<property name="net.sf.jasperreports.export.pdf.tag.table" value="end"/>
Also remove every <property> element named net.sf.jasperreports.export.pdf.tagger.factory, regardless of its value.
This property is no longer configurable in Cadenza.
If these properties are also configured in the parameter list of the data view with a JasperReports report, remove the corresponding entries.
Uncaught exception in the work queue (file-path error)
Symptom: The Cadenza log contains net.disy.cadenza.executor.AbstractVirtualThreadWorkQueue – Uncaught exception within work queue execution.
The report is displayed as a blank page or does not finish rendering.
Cause: The report or a subreport references an external resource, such as a subreport file, font, image, or data file, by using an bsolute file-system path.
The path may be specified in a <parameterExpression>, <subreportExpression>, or <propertyExpression> CDATA block. After the JasperReports library upgrade, the absolute path may no longer be resolved.
Solution:
-
Open the
.jrxmlfile in Jaspersoft Studio. -
Search for absolute file-system paths, such as
C:\,/opt/, or/home/. -
Check the path and replace it with a path relative to the report file, if required. For example:
sub/charts.jasper fonts/Arial.ttf -
Make sure that the referenced file is included in the same ZIP archive that you import into Cadenza.
-
Recompile the report and import it again.
Java expressions fail to compile
Symptom: After migration, the report compiles in Jaspersoft Studio but throws a CompilationException when it is run in Cadenza.
Alternatively, the Jaspersoft Studio build log may show errors in lines containing Java-specific syntax.
Cause: JasperReports 7 changed the default expression-engine behavior. Expressions written in Java that rely on classes or semantics not exposed to the Groovy compiler may fail.
Solution:
-
Open the report in Jaspersoft Studio and select Report > Properties > General.
-
Set the Language to Groovy.
-
Recompile the report. Most Java expressions are converted automatically because Groovy is a superset of Java.
-
If an expression still fails, adapt its syntax. For example, replace Java
importstatements with fully qualified class names or remove explicit type declarations where Groovy type inference can be used. -
Test the report completely before importing it into Cadenza again.
Identifying the Old Report Schema
You can identify a report created with an earlier JasperReports version by checking the version tag in the JRXML header or by inspecting the element structure in the code. The following examples illustrate the differences.
Earlier version: JasperReports 6.20.5
<textField>
<reportElement x="5" y="6" width="549" height="20"
forecolor="#3B687F"
uuid="446c3d0a-558e-48a1-8974-e6ba3c5b7198">
<property name="com.jaspersoft.studio.unit.height" value="px"/>
</reportElement>
<textElement textAlignment="Left">
<font size="12" isBold="true"/>
</textElement>
<textFieldExpression><![CDATA[]]></textFieldExpression>
</textField>
Current version: JasperReports 7.0.8
<element kind="textField"
uuid="446c3d0a-558e-48a1-8974-e6ba3c5b7198"
x="5" y="6" width="549" height="20"
forecolor="#3B687F"
fontSize="12.0"
bold="true"
hTextAlign="Left">
<expression><![CDATA[]]></expression>
<property name="com.jaspersoft.studio.unit.height" value="px"/>
</element>