Link to home
Start Free TrialLog in
Avatar of Rrugemalira
Rrugemalira

asked on

java.lang.NoClassDefFoundError: Could not initialize class sun.awt.X11GraphicsEnvironment

I'm using NetBeans 5.5.1 IDE with Visual Web Pack. My OS is Linux Fedora Core 6 and the server is Sun Java System Application Server.
I'm developing an application which includes a JSP to display a bar-chart graph using CeWolf.
I get the following two severe errors on running the JSP:

1.  Message ID: StandardWrapperValve[CewolfServlet]
Servlet.service() for servlet CewolfServlet threw exception
java.lang.NoClassDefFoundError: Could not initialize class sun.awt.X11GraphicsEnvironment
at java.lang.Class.forName0(Native Method)

2.Message ID: CewolfServlet
Could not initialize class sun.awt.X11GraphicsEnvironment
java.lang.NoClassDefFoundError: Could not initialize class sun.awt.X11GraphicsEnvironment
      at java.lang.Class.forName0(Native Method)
      at java.lang.Class.forName(Class.java:169)
      at java.awt.GraphicsEnvironment.getLocalGraphicsEnvironment(GraphicsEnvironment.java:68)
      at sun.awt.X11.XToolkit.<clinit>(XToolkit.java:89)
 
 I'd appreciate your kind guidance in solving this problem    
Avatar of Venabili
Venabili
Flag of Bulgaria image

Do you have a X11 server daemon running on the server? Because this class is using native codes which on Unix need X11.
The other option would be to use PJA Toolkit (http://www.eteks.com/pja/en/) instead of the standard AWT

Although... which JDK you use? For 1.4.2+,  it may be enough to use java.awt.headless=true
setProperty( "java.awt.headless", true ); in the code or as a start parameter.
Avatar of Rrugemalira
Rrugemalira

ASKER

I'm using jdk1.6.0_02
The system monitor shows I have Xorg sleeping but consuming CPU. Moreover, I'm working in graphics mode with the netbeans IDE and I can see some graphics on the JSP pages when my application is running (except for the chart component)
You will forgive my ignorance, but I do now know where to setProperty("java.awt.headless", true)
In which code do I set it? In the jsp that renders the chart? In the bean that implements the dataset producer?
ASKER CERTIFIED SOLUTION
Avatar of Venabili
Venabili
Flag of Bulgaria image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Avatar of rrz
rrz
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
I entered into Sun Java System Application Server Administration Console
Clicked on:
Application Server --> JVM Settings --> JVM Options
and added the JVM option: -Djava.awt.headless=true
Stopped the server and re-started it.
I'm now able to display the bar-chart graphics. Praise be to God!
I thank all of you for your kind help.