Could not initialize class net.sf.jasperreports.engine.util.JRStyledTextParser

Hi all

I just upgrade from Jasper5.0.1 to Jasper5.5.1. But when i run report, i got the error:

threw a JobExecutionException:
org.quartz.JobExecutionException: java.lang.NoClassDefFoundError: Could not initialize class net.sf.jasperreports.engine.util.JRStyledTextParser [See nested exception: java.lang.NoClassDefFoundError: Could not initialize class net.sf.jasperreports.engine.util.JRStyledTextParser]
    at com.lucent.vital.vq.reportserver.quartz.QuartzReportJob.execute(QuartzReportJob.java:156)
    at org.quartz.core.JobRunShell.run(JobRunShell.java:199)
    at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:546)
Caused by: java.lang.NoClassDefFoundError: Could not initialize class net.sf.jasperreports.engine.util.JRStyledTextParser
    at net.sf.jasperreports.engine.fill.JRBaseFiller.<init>(JRBaseFiller.java:123)
    at net.sf.jasperreports.engine.fill.JRVerticalFiller.<init>(JRVerticalFiller.java:88)
    at net.sf.jasperreports.engine.fill.JRVerticalFiller.<init>(JRVerticalFiller.java:103)
    at net.sf.jasperreports.engine.fill.JRVerticalFiller.<init>(JRVerticalFiller.java:61)
    at net.sf.jasperreports.engine.fill.JRFiller.createFiller(JRFiller.java:179)
    at net.sf.jasperreports.engine.fill.BaseFillHandle.<init>(BaseFillHandle.java:75)
    at net.sf.jasperreports.engine.fill.AsynchronousFillHandle.<init>(AsynchronousFillHandle.java:98)
    at net.sf.jasperreports.engine.fill.AsynchronousFillHandle.<init>(AsynchronousFillHandle.java:68)
    at net.sf.jasperreports.engine.fill.AsynchronousFillHandle.createHandle(AsynchronousFillHandle.java:149)
    at net.sf.jasperreports.engine.fill.AsynchronousFillHandle.createHandle(AsynchronousFillHandle.java:202)
 

I foundsome solutions on internet: (http://stackoverflow.com/questions/3628302/jasperreports-noclassdeffound...)

"The Sun AWT classes on Unix and Linux have a dependence on the X Window System. When you use these classes, they expect to load X client libraries and be able to talk to an X display server. This makes sense if your client has a GUI; unfortunately, it's required even if your client uses AWT but does not have a GUI (which is my case, generating a report from a web application)

The way to bypass this, is setting a system property java.awt.headless=trueon system startup."

I tried to set in my app:

System.setProperty("java.awt.headless", "true");

But i still got above error.

My report still run sucessfully with Jasper 5.0.1 without any changes.

Do you have another solution to fix this issue?

Thanks,

Tai Hoang

 

jmikel's picture
264
Joined: Oct 21 2013 - 9:38pm
Last seen: 8 years 11 months ago

Ok , la solución que ami me resulto fue actualizar esta libreria common-javaflow.jar, les dejo la liga para la descarga. http://www.java2s.com/Code/Jar/c/Downloadcommonsjavaflowjar.htm

anteriormente en mi proyecto estaba trabajando con la libreria common-javaflow20060411.jar

Espero haber ayudado!! (y)

 

israider - 8 years 2 months ago

5 Answers:

Have you looked into missing fonts? I assume by "Jasper5.5.1" that you mean Jaspersoft Studio?" You're running it on linux?

hozawa's picture
190313
Joined: Apr 24 2010 - 4:31pm
Last seen: 4 years 3 months ago

Hi hozawa.

I don't use Jaspersoft Studio. I override  some classes from JasperReport library to report my report.

Below list jars that i have used:

jasperreports-5.5.1. jar

commons-beanutils-1.8.0.jar

commons-collections-2.1.1.jar

commons-digester-2.1.jar

commons-javaflow-20060411.jar

commons-logging-1.1.1.jar

iText-2.1.7.jar

jasperreports-javaflow-5.5.1.jar

jcommon-1.0.15.jar

jdt-compiler-3.1.1.jar

jfreechart-1.0.12.jar

poi-3.7-20101029.jar

jasperreports-fonts-5.5.1.jar

I run on window server (64-bit Operating System). My report still run normally with Jasper Library 5.0.1.

Thanks,

Tai Hoang

 

jmikel's picture
264
Joined: Oct 21 2013 - 9:38pm
Last seen: 8 years 11 months ago

Had the same problem. Apart from few missing dependencies on the way (moved from ant to maven) my problem was fixed by adding            

<dependency>
                <groupId>xml-apis</groupId>
                <artifactId>xml-apis</artifactId>
                <version>1.4.01</version>
</dependency>

Apparently JRStyledTextParser is using dependency from xml-apis in the constructor

dtyshecky's picture
411
Joined: May 14 2014 - 4:51pm
Last seen: 9 years 3 months ago

If you're using SYS V init and running in a container such a Tomcat, DON'T start the script directly with:

sudo /etc/init.d/tomcat7 start

That will start it without a clean environment.

Instead, use the service command:

sudo /sbin/service tomcat7 start
Pixel's picture
396
Joined: Dec 3 2013 - 8:30am
Last seen: 4 months 1 week ago

Tenia el mismo problema, lo solucione, removiendo la libreria jar xvf jasperreports-5.....jar, y en su lugar le coloque la libreria jasperreports-5.2.0.jar

Y en los reportes solo utilice fonts , sansSerif o Serif

 

 

 

palaciobravo's picture
Joined: Jan 25 2013 - 12:45pm
Last seen: 3 years 4 months ago
Feedback