UIM CABI - Error - Could not initialize class net.sf.jasperreports.engine.util.JRStyledTextParser
search cancel

UIM CABI - Error - Could not initialize class net.sf.jasperreports.engine.util.JRStyledTextParser

book

Article ID: 186661

calendar_today

Updated On:

Products

DX Unified Infrastructure Management (Nimsoft / UIM)

Issue/Introduction

After install JasperReports V7, for CA UIM, the installation procedure was successful, however when any report is executed, the following error is thrown.

Error Message

java.lang.NoClassDefFoundError: Could not initialize class net.sf.jasperreports.engine.util.JRStyledTextParser

The error looks as follow in jasperserver.log

2020-03-06 09:16:37,104 ERROR ErrorPageHandlerAction,http-nio-80-exec-15:115 - Error UID 0919ea29-9e1d-4431-8363-9e555c898928
com.jaspersoft.jasperserver.api.JSException: java.lang.NoClassDefFoundError: Could not initialize class net.sf.jasperreports.engine.util.JRStyledTextParser
...
Caused by: java.lang.NoClassDefFoundError: Could not initialize class net.sf.jasperreports.engine.util.JRStyledTextParser


Environment

Release : UIM9.2.0, 20.X

Component :  IM Reporting / Admin / Configuration,Cabi 4.30

Operating System: Red Hat Enterprise Linux 64Bits Server release 7.3, centos 7.8

Cause

This error is documented in JasperSoft Community: https://community.jaspersoft.com/wiki/error-when-running-reports-could-not-initialize-class

It is usually resolved adding the Java Parameter -Djava.awt.headless=true

However only doing this not always resolve the issue, there are plenty of reports, and documented solutions applied by users to resolve the problem.

http://stackoverflow.com/questions/4998762/could-not-initialize-class-net-sf-jasperreports-engine-util-jrstyledtextparser

Resolution

To resolve the problem in this case, it was required to do next:

1. Open cabi probe Raw Configure->startup->opt, and add a java_opts key, with next in it: -Djava.awt.headless=true
2. install the package called: dejavu-serif-fonts in the Operating System where Jasper/CABI is installed, doing: yum install dejavu-serif-fonts
3. reboot the server where Jasper is installed

Additional Information

You may need to add the -Djava.awt.headless=true entry to the following Jasper config files:

$JASPER_HOME/apache-tomcat/bin/catalina.sh
$JASPER_HOME/apache-tomcat/bin/tools-wrapper.sh
$JASPER_HOME/apache-tomcat/bin/setenv.sh