java.lang.NoClassDefFoundError: sun/awt/X11GraphicsEnvironment!_NEWLINE_!at java.lang.Class.forName0(Native Method)
2 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Vijay_Kumar
Posted On:   Thursday, July 19, 2001 12:51 PM

Hello, my servlet running in a Sun Solaris server is unable to use a

			
new Font(...)

instruction, and seems it can not load sun.awt.X11GraphicsEnvironment.class, even if it is present inside rt.jar of the JRE. Can anyone explain me why this class is not found?

Re: java.lang.NoClassDefFoundError: sun/awt/X11GraphicsEnvironment!_NEWLINE_!at java.lang.Class.forName0(Native Method)

Posted By:   Nathan_Meyers  
Posted On:   Thursday, July 19, 2001 07:32 PM

Re: java.lang.NoClassDefFoundError: sun/awt/X11GraphicsEnvironment!_NEWLINE_!at java.lang.Class.forName0(Native Method)

Posted By:   Luigi_Viggiano  
Posted On:   Thursday, July 19, 2001 01:03 PM

I got same error using some libraries to generate pdf and jpeg (JClass ServerCharts and StyleReport Pro for example)on server side to be shown inside a servlet/jsp, and I suppose you are getting this in a servlet because you are generating graphic content on the server.

The JVM has found the sun.awt.X11GraphicsEnvironment.class but it was unable to instantiate and use it because probably there's no X11 server daemon running on the server (this is very common for unix production servers).

As you are accessing AWT services to plot (even if in memory) a graphic to be sent as http content to the client, AWT uses native calls to render the graphics, and the graphic layer is not aivable because X11 is not running. You may consider to install X11 on the server or consider to use an emulated graphic environment such as PJA Toolkit (PJA stands for Pure Java AWT Toolkit, it will be slower than native plotting but it will work).

Hope this helps.

About | Sitemap | Contact