It you are trying to use graphics on a server, that does not run X, you may run into all sorts of problems with the AWT toolkit. When the AWT toolkit is initialised it expects to find an X server, regardless of whether its needed for actual display.
If you are running JDK 1.4 or later, you should add
-Djava.awt.headless=true to your Tomcat startup.
I achieved this by editing the
Below is a downloadable patch file. Tomcat 4 Patch