Jump to content
Changes to the Jaspersoft community edition download ×

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


jmikel

Recommended Posts

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-noclassdeffounderror-exception-on-net-sf-jasperreports-engine-util)

"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

 

Link to comment
Share on other sites

  • Replies 7
  • Created
  • Last Reply

Top Posters In This Topic

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

 

Link to comment
Share on other sites

  • 1 month later...

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>[/code]

 

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

 

Link to comment
Share on other sites

  • 1 year later...
  • 1 year later...

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

Link to comment
Share on other sites

  • 3 years later...
  • 3 years later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...