java.lang.NoClassDefFoundError: sun/awt/X11GraphicsEnvironment


EJB programming & troubleshooting: java.lang.NoClassDefFoundError: sun/awt/X11GraphicsEnvironment

  1. Hi,
    I am running wls6.1 on a Red hat box.
    From my ejb, using some helper classes, i am trying to create the image of a bar chart( ofcourse thru awt ).
    But at times this throws an exception
    java.lang.NoClassDefFoundError: sun/awt/X11GraphicsEnvironment

    I have set the DISPLAY parameter properly.. but this problem recurs ..!!!
    from a lot of discussion forums i learned that this is a common issue on serverside java under linux.... but nobody had susggested a solution!
    any thoughts or similar experiance??
    pls answer.
  2. I recently had this exact same problem.

    What happens it the first time you run the app using the awt classes, you get a java.lang.InternalError saying it can't connect to the X server using the specified display variable.

    After that, you get NoClassDefFoundErrors as you mentioned.

    I solved this by doing two things:

    1. Installing a Virtual Frame Buffer.
    2. Setting my Display Variable to the IP address of the host I am running on.

    I just went to and found the Virtual Frame Buffer RPM for my RedHat 7.2 distribution. Then I installed it. Next, I set the DISPLAy variable to the IP address of the machine the Web App was running on. Then, I started the Virtual Frame Buffer using the command:

    /usr/X11R6/bin/Xvfb :0.0 -screen 0.0 1152x900x8 &

    Finally, I restarted the web container.

    As a side note, it is interesting that you posted this problem because I just encountered and fixed this problem yesterday . . . Spooky kind of.

    Dave Costakos
  3. Thanks Man! ... it helped!
    btw, What an accidental coincidence of the incidents!!!!
  4. Thanks Dave, this solved my hours of frustration too.

    Clinton Lee