Screaming Headless Servers
Problem
If you’re working with a server-side application, like I am, that imports a javax.swing
package, you might get strange errors, such as the one described here. javax.swing
packages expect to find an X11 server running on the machine. In my case, it wants to access the graphical subsystem because JFreeReport wants to use a TableModel
as a kind of spreadsheet.
Solution
append java.awt.headless=true
to your JAVA_OPTS
in catalina.sh
. Mine ended up looking like this.
JAVA_OPTS=-Dsalmon.props.path=/home/opgi/bin/jakarta-tomcat-4.1.30/salmon/properties
JAVA_OPTS = "$JAVA_OPTS -Djava.awt.headless=true"