2014年9月7日日曜日

Jenkins で Graphics N/A Unable to access X.が出たとき

Jenkinsで本来グラフが表示される部分に次のメッセージが表示されるとき

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

Open JDKをインストールしている環境ではdejavu-sans-fontsというパッケージを
インストールすることで解決できるようです。
https://wiki.jenkins-ci.org/display/JENKINS/Jenkins+got+java.awt.headless+problem
VagrantなどでJenkinsをCentOS環境にセットアップするときには次のような感じにしています。
  1. # install Jenkins
  2. sudo yum install -y java-1.6.0-openjdk
  3. sudo wget -O /etc/yum.repos.d/jenkins.repo http://pkg.jenkins-ci.org/redhat/jenkins.repo
  4. sudo rpm --import https://jenkins-ci.org/redhat/jenkins-ci.org.key
  5. sudo yum install -y jenkins dejavu-sans-fonts
  6. # booting and autorun jenkins
  7. sudo chkconfig jenkins on
  8. sudo /sbin/service jenkins start