Hudson got java.awt.headless problem

Problem

Hudson got java.awt.headless problem

I installed Hudson in Ubuntu linux and run the Hudson in the tomcat6.

I open any Hudson page which is showing any trend chart. I get the following error on the page.

Graphics N/A Unable to access X. You need to run the web container in the headless mode. Add -Djava.awtheadless=true to VM.

I check the tomcat6 starting script, the JVM property java.awt.headless is set to true already.
I check through the Hudson's Manage Hudson->System Information page. It also shows the java.awtheadless is set to true.

Looking through the Tomcat logs, the following error can be found:

 java.lang.Error: Probable fatal error:No fonts found.
Solution (for Open JDK)

We had the same problem too using Hudson in Tomcat6 on Ubuntu 9.10 server.

Obviously graphics rendering needs access to font metrics. So check java /etc/java-6-openjdk/fontconfig.properties and install missing fonts. OpenJDK refers to DejaVu-Fonts. So type

sudo apt-get install ttf-dejavu

Restart Tomcat and enjoy graphics.

Solution (for Sun JDK)

I also had the same problem using Hudson in Tomcat 6 on Ubuntu 9.10 Server, but this time with Sun's JDK6.

I initially only installed the package 'sun-java6-jdk'. After seeing the above fonts error, I tried installing the 'sun-java6-fonts' package, but that didn't seem to solve my problem. I gave up trying to find the exact package I needed to get things working and just decided to remove what I had and reinstall the "whole shebang":

sudo apt-get remove sun-java6*
sudo apt-get install sun-java6*

Maybe a little brute'ish, but it worked. Hudson now makes all of its pretty charts.

Labels:

Enter labels to add to this page:
Wait Image 
Looking for a label? Just start typing.