Performance graphs on Jenkins causing “Could not initialize class org.jfree.chart.JFreeChart” exceptions

送分小仙女□ 提交于 2019-12-09 15:43:33

问题


When Jenkins tries to generate the Performance Trends graphs there launches several exceptions always with root cause: "java.lang.NoClassDefFoundError: Could not initialize class org.jfree.chart.JFreeChart"

This is what I did:

  • desployed Jenkins , tried with v1.532.2 (stable) and also with v1.539-SNAPSHOT
    • didn't configured security
    • just set paths to my JDK (oracle's jdk1.7.0_51), MAVEN (3.1.1) and GIT (1.8.1.2)
  • enabled these plugins:
    • Checkstyle v3.39
    • Jenkins Cobertura v1.9.3
    • FindBugs v4.51
    • Warnings v4.39
    • PMD v3.38
    • Performance v.1.10
    • Jenkins Git client v1.6.2
    • Jenkins Git 2.0.1

Then I created a project which successfully creates a JMeter report file from my Java webapp using the plugin jmeter-maven-plugin v1.9.0, but there doesn't appear the Performance Trend graphs on the project's page. Jenkins really gathers the results because it shows me the response times, but can't show me the graphs. There launches several Exceptions always with root cause: "java.lang.NoClassDefFoundError: Could not initialize class org.jfree.chart.JFreeChart" . Here you will find a complete StackTrace: http://pastebin.com/uhiNR7XD

Jenkins already has jcommon-1.0.12.jar and jfreechart-1.0.9.jar at it's /WEB-INF/lib/ . This other post doesn't apply.

Can you help me, please?

Thanks in advance!

/ Angel


回答1:


If you're still having issues, try commenting out this line:

assistive_technologies=org.GNOME.Accessibility.AtkWrapper

Located in /etc/java-8-openjdk/accessibility.properties. Just prepend the line with #.




回答2:


Angels Answer is correct, you have to add -Djava.awt.headless=true.

However, in my case it wasn't enough: I was running Jenkins on openjdk-8-jre-headless (Debian), which doesn't contain some libraries that JFreeChart requires.

Solution: use openjdk-jre-8 instead of openjdk-jre-8-headless.

Just an additional note to the people arriving from search engines.




回答3:


Solved! Somebody helped me to solve it here : https://groups.google.com/forum/#!topic/jenkinsci-users/o_Dr7Tn0i3U

It's not a bug in Jenkins but a miss-configuration. The solution is just adding -Djava.awt.headless=true to Jenkin's runtime.

I'm running Jenkins as a webapp on my Tomcat, then I just added this line to my /opt/tomcat/bin/catalina.sh : CATALINA_OPTS=-Djava.awt.headless=true

I wanted you to share this solution. Cheers from Barcelona.

/ Angel




回答4:


On a Debian 9 installation I was able to fix this problem by installing the libjfreechart-java package:

sudo apt-get install libjfreechart-java

I found this solution in the relevant Jenkins bug report: JENKINS-39636




回答5:


My java.awt.headless is already true. So I carefully checked this link and found the solution which works perfectly fine for me:

ubuntu

sudo apt-get install libfontconfig

centos

yum install libXext libXrender fontconfig libfontconfig.so.1


来源:https://stackoverflow.com/questions/21841269/performance-graphs-on-jenkins-causing-could-not-initialize-class-org-jfree-char

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!