GifServlet on Linux

Linux has given many Servlet developers headaches when attempting to create dynamic images. Java requires a GUI to perform any AWT functions. A Linux machine that isn't running X Windows doesn't have a GUI for Java to use. :-(

To get around this problem I use Xvfb (X Virtual Frame Buffer). It provides the necessary hooks for Java to use the AWT.

Run

Xvfb :99 -screen 0 1x1x8 &
This starts Xvfb with a virtual screen size of 1 pixel and a color depth of 8 bits. GIF only supports up to 256 colors so we don't need to run any more than 8 bit color. The 1 pixel virtual screen size doesn't matter because we don't want to write directly to the screen anyway. As far as I can tell it doesn't matter which user runs Xvfb.

JServ Instructions:

Add this line to jserv.properties:
wrapper.env=DISPLAY=:99
This sets an environment variable in JServ to let JServ know which server to connect to.

JBoss Instructions From Justus Brugman:

Add this line to run.sh:
export DISPLAY=unix:99.0

If you have suggestions on how to run on another platform let me know and I'll add them here.

Let me know if you have any problems with getting it to run and I'll try to help.
Aaron

Back to GifServlet