Allowing Java Classes in Jasper Reports Expressions
For security reasons, Java classes are restricted within the report expressions, such as <textFieldExpression> in Jasper reports.
To allow specific Java classes in these expression, you must add the property net.sf.jasperreports.report.class.whitelist.custom.{arbitary_name} to jasperreports.properties file by running the following command:
xconfmanager -s net.sf.jasperreports.report.class.whitelist.custom.<{arbitary_name}>=
"<Comma Separated Java Classes>" -t codebase/jasperreports.properties -p
Where:
<{arbitary_name}>—Can be any name, not bound to a specific value or predefined naming convention.
<Comma Separated Java Classes>—Defines a list of classes allowed in the report expressions. Multiple Java class names can be added using a comma-separated list. Wildcards can be used in Java class names. For more information, see Wildcard Usage.
Wildcards Usage
Use an asterisk (*) as a wildcard character to include any class/package name or part of a class/package name. For example:
net.sf.jasperreports. * includes any class in the net.sf.jasperreports package, excluding subpackages.
net.sf.jasperreports.*Enum includes any class in the net.sf.jasperreports package ending with Enum.
Use double asterisks (**) as a wildcard character to include any fully qualified class name or part of a fully qualified class name. For example:
net.sf.jasperreports.** includes any class in the net.sf.jasperreports package or its subpackages.
net.sf.jasperreports.**Enum includes any class ending with Enum in the net.sf.jasperreports package or its subpackages.
(**) includes any class.
Was this helpful?