• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 31908
  • Last Modified:

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    
0
Rrugemalira
Asked:
Rrugemalira
  • 2
  • 2
2 Solutions
 
VenabiliCommented:
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.
0
 
RrugemaliraAuthor Commented:
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?
0
 
VenabiliCommented:
Honesly - I do not remember.. Haven't touched AWT from years. I would try with the bean.

The error is definitely claiming that there is no X server.
0
 
rrzCommented:
System.setProperty("java.awt.headless", "true");
from  
http://www.reportmill.com/support/Headless.html   
aslo see
http://java.sun.com/j2se/1.4.2/docs/guide/awt/AWTChanges.html#headless   
0
 
RrugemaliraAuthor Commented:
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.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now