If you want to draw a barcode onto a Graphics2D canvas then you should use the
draw() method. The paintX() methods are used internally by Swing and should
not be called by your code (even though they are public).
There is a known issue with the Java runtime where a display is assumed to be present when accessing the graphics environment. More information is available
at http://developer.java.sun.com/developer/bugParade/bugs/4281163.html, but the most common workaround is to run an X11 process purely to satisfy the needs of
the JVM, even if the machine is headless.
The machine generating the barcode is in Headless mode. The barcode servlet should automatically assume this mode, but you can force barbecue to do this at any time by
calling
EnvironmentFactory.setHeadlessMode()
in your code. Alternatively, try explicitly setting the resolution
on the barcode.