My servlets work on XP or Windows 2000, but not on Solaris. Why?
To generate an image, KavaChart employs various classes in Java's AWT package. Java's AWT package maps Java abstractions into specific operating system methods by using something called peer classes. These peer classes are usually created using native code (hence "native peer methods") for performance purposes. Windows implementations use code that calls the Windows GDI, Macintosh the Mac Toolbox, and Unix implementations use Xlib.
If you're using JDK 1.4 or newer, this means you should set the System property "java.awt.headless" to "true". From the command line:
java ... -Djava.awt.headless=true ...
For more information on what's going on, or for alternatives that work with earlier versions of Java, see below:
Graphics operations generally require actual display hardware of some sort on the server, even though nothing will actually appear on the screen. For Windows and NT servers, this isn't a problem. Unix servers must have access to an X-windows display. The display needn't be local (although performance may degrade if it's not), and it can even be a "virtual" display, such as the xvfb (X Windows Virtual Framebuffer), which can be freely downloaded as an RPM from most Linux sites.
A binary Solaris version of xvfb can be found here, along with usage and installation notes.
AIX releases include a fileset called x11.vfb that works the same as xvfb. Chapter 6.1 of this document describes installation and compatibility issues for this fileset.
Bottom line? For Unix, your DISPLAY environment variable must point to an actual or virtual X server.
It's also possible to replace these peer classes with non-native, pure Java implementations. We suggest you try PJAToolkit, a free download from ETeks if you want to try a pure Java approach. If your native language is French, use this link.
For some Java web servers (e.g. Apache JServ and Tomcat environments), setting the DISPLAY environment variable is a bit obscure. For Apache servers, use the wrapper.env file to specify your environment.
JDK 1.4 implements a "Headless Support" option along with new GraphicsEnvironment methods, and should run without the X windows requirement. See this link for more information: http://java.sun.com/j2se/1.4/docs/guide/awt/AWTChanges.html#headless
Some additional X-windows notes: