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

eddy picture eddy · Feb 15, 2011 · Viewed 67.5k times · Source

I'm trying to display my reports on the browser , but I keep getting this error:

enter image description here

the strange thing about this, is that it only happens when I attempt to generate the reports from the version installed on the server, but not when I do it locally from my pc

Have you any idea why this is happening ?

Answer

Master.Aurora picture Master.Aurora · Jun 5, 2014

This seems like a Headless mode issue. You need to set the java.awt.headless property to true. That can be done using:

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

Or, by setting the headless property in your tomcat startup command as -Djava.awt.headless=true

Also, you can read more on why this is necessary, you can read about the Headless mode here