Jasper Reports: Correcting java.lang.NoClassDefFoundError

Document created by karen_brooks Employee on Jun 28, 2017
Version 1Show Document
  • View in full screen mode

Issue

The two errors below may appear when attempting to run a Spectrum Report in Jasper Reports.  The environment for this is RHEL 7.2

 

 

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

Error Trace 
 
com.jaspersoft.jasperserver.api.JSException: java.lang.NoClassDefFoundError: Could not initialize class net.sf.jasperreports.engine.util.JRStyledTextParser at com.jaspersoft.jasperserver.api.engine.jasperreports.service.impl.EngineServiceImpl.fillReport(EngineServiceImpl.java:628) at com.jaspersoft.jasperserver.api.engine.jasperreports.service.impl.EngineServiceImpl.executeReportUnitRequest(EngineServiceImpl.java:1953) at com.jaspersoft.jasperserver.api.engine.jasperreports.domain.impl.ReportUnitRequest.execute(ReportUnitRequest.java:67) at com.jaspersoft.jasperserver.api.engine.jasperreports.service.impl.EngineServiceImpl.execute(EngineServiceImpl.java:505) at sun.reflect.GeneratedMethodAccessor822.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:317) at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:183) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150) at org.springframework.aop.aspectj.MethodInvocationProceedingJoinPoint.proceed(MethodInvocationProceedingJoinPoint.java:80) at com.jaspersoft.ji.license.LicenseCheckAspect.runReport(LicenseCheckAspect.java:139) at sun.reflect.GeneratedMethodAccessor821.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498)
Working Solution
The fix I've found that works is to modify the $JASPER_HOME/apache-tomcat/bin/tools-wrapper.sh file.  
Add the following highlighted line to the bottom of the file and cycle the servers.
# ----- Execute The Requested Command -----------------------------------------

 

exec "$_RUNJAVA" $JAVA_OPTS $TOOL_OPTS \
-Djava.endorsed.dirs="$JAVA_ENDORSED_DIRS" -classpath "$CLASSPATH" \
-Dcatalina.home="$CATALINA_HOME" \
-Djava.awt.headless=true \
org.apache.catalina.startup.Tool "$@"
 
Related Information
4 people found this helpful

Attachments

    Outcomes