Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-39636

Could not initialize class org.jfree.chart.JFreeChart

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Minor Minor
    • core
    • None
    • Debian Testing
      Jenkins 2.19.2
      Java 1.8.0_111

      All graphs in Jenkins (eg. /buildTimeGraph/png) result in this error: "javax.servlet.ServletException: java.lang.NoClassDefFoundError: Could not initialize class org.jfree.chart.JFreeChart"

      JENKINS-21839 looked similar, but I've confirmed that -Djava.awt.headless=true is already being passed to the Java process.

      Full stack trace:

      javax.servlet.ServletException: java.lang.NoClassDefFoundError: Could not initialize class org.jfree.chart.JFreeChart
      	at org.kohsuke.stapler.Stapler.tryInvoke(Stapler.java:796)
      	at org.kohsuke.stapler.Stapler.invoke(Stapler.java:876)
      	at org.kohsuke.stapler.MetaClass$3.doDispatch(MetaClass.java:196)
      	at org.kohsuke.stapler.NameBasedDispatcher.dispatch(NameBasedDispatcher.java:58)
      	at org.kohsuke.stapler.Stapler.tryInvoke(Stapler.java:746)
      	at org.kohsuke.stapler.Stapler.invoke(Stapler.java:876)
      	at org.kohsuke.stapler.MetaClass$5.doDispatch(MetaClass.java:233)
      	at org.kohsuke.stapler.NameBasedDispatcher.dispatch(NameBasedDispatcher.java:58)
      	at org.kohsuke.stapler.Stapler.tryInvoke(Stapler.java:746)
      	at org.kohsuke.stapler.Stapler.invoke(Stapler.java:876)
      	at org.kohsuke.stapler.MetaClass$5.doDispatch(MetaClass.java:233)
      	at org.kohsuke.stapler.NameBasedDispatcher.dispatch(NameBasedDispatcher.java:58)
      	at org.kohsuke.stapler.Stapler.tryInvoke(Stapler.java:746)
      	at org.kohsuke.stapler.Stapler.invoke(Stapler.java:876)
      	at org.kohsuke.stapler.Stapler.invoke(Stapler.java:649)
      	at org.kohsuke.stapler.Stapler.service(Stapler.java:238)
      	at javax.servlet.http.HttpServlet.service(HttpServlet.java:790)
      	at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:812)
      	at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1669)
      	at hudson.util.PluginServletFilter$1.doFilter(PluginServletFilter.java:135)
      	at hudson.plugins.greenballs.GreenBallFilter.doFilter(GreenBallFilter.java:59)
      	at hudson.util.PluginServletFilter$1.doFilter(PluginServletFilter.java:132)
      	at hudson.util.PluginServletFilter.doFilter(PluginServletFilter.java:126)
      	at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1652)
      	at hudson.security.csrf.CrumbFilter.doFilter(CrumbFilter.java:86)
      	at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1652)
      	at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:84)
      	at hudson.security.UnwrapSecurityExceptionFilter.doFilter(UnwrapSecurityExceptionFilter.java:51)
      	at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:87)
      	at jenkins.security.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:117)
      	at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:87)
      	at org.acegisecurity.providers.anonymous.AnonymousProcessingFilter.doFilter(AnonymousProcessingFilter.java:125)
      	at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:87)
      	at org.acegisecurity.ui.rememberme.RememberMeProcessingFilter.doFilter(RememberMeProcessingFilter.java:142)
      	at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:87)
      	at org.acegisecurity.ui.AbstractProcessingFilter.doFilter(AbstractProcessingFilter.java:271)
      	at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:87)
      	at jenkins.security.BasicHeaderProcessor.doFilter(BasicHeaderProcessor.java:93)
      	at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:87)
      	at org.acegisecurity.context.HttpSessionContextIntegrationFilter.doFilter(HttpSessionContextIntegrationFilter.java:249)
      	at hudson.security.HttpSessionContextIntegrationFilter2.doFilter(HttpSessionContextIntegrationFilter2.java:67)
      	at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:87)
      	at hudson.security.ChainedServletFilter.doFilter(ChainedServletFilter.java:76)
      	at hudson.security.HudsonFilter.doFilter(HudsonFilter.java:171)
      	at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1652)
      	at org.kohsuke.stapler.compression.CompressionFilter.doFilter(CompressionFilter.java:49)
      	at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1652)
      	at hudson.util.CharacterEncodingFilter.doFilter(CharacterEncodingFilter.java:82)
      	at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1652)
      	at org.kohsuke.stapler.DiagnosticThreadNameFilter.doFilter(DiagnosticThreadNameFilter.java:30)
      	at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1652)
      	at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:585)
      	at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:143)
      	at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:553)
      	at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:223)
      	at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1127)
      	at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:515)
      	at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:185)
      	at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1061)
      	at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141)
      	at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:97)
      	at org.eclipse.jetty.server.Server.handle(Server.java:499)
      	at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:311)
      	at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:257)
      	at org.eclipse.jetty.io.AbstractConnection$2.run(AbstractConnection.java:544)
      	at winstone.BoundedExecutorService$1.run(BoundedExecutorService.java:77)
      	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
      	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
      	at java.lang.Thread.run(Thread.java:745)
      Caused by: java.lang.NoClassDefFoundError: Could not initialize class org.jfree.chart.JFreeChart
      	at org.jfree.chart.ChartFactory.createStackedAreaChart(ChartFactory.java:1124)
      	at hudson.model.Job$3.createGraph(Job.java:1402)
      	at hudson.util.Graph.render(Graph.java:93)
      	at hudson.util.Graph.doPng(Graph.java:120)
      	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
      	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      	at java.lang.reflect.Method.invoke(Method.java:498)
      	at org.kohsuke.stapler.Function$InstanceFunction.invoke(Function.java:324)
      	at org.kohsuke.stapler.Function.bindAndInvoke(Function.java:167)
      	at org.kohsuke.stapler.Function.bindAndInvokeAndServeResponse(Function.java:100)
      	at org.kohsuke.stapler.MetaClass$1.doDispatch(MetaClass.java:124)
      	at org.kohsuke.stapler.NameBasedDispatcher.dispatch(NameBasedDispatcher.java:58)
      	at org.kohsuke.stapler.Stapler.tryInvoke(Stapler.java:746)
      	... 68 more
      

          [JENKINS-39636] Could not initialize class org.jfree.chart.JFreeChart

          Andy Wang added a comment -

          This will solve it:

          ubuntu
          sudo apt-get install libfontconfig

          centos
          yum install libXext libXrender fontconfig libfontconfig.so.1

           

          Andy Wang added a comment - This will solve it: ubuntu sudo apt-get install libfontconfig centos yum install libXext libXrender fontconfig libfontconfig.so.1  

          Oleg Nenashev added a comment -

          Oleg Nenashev added a comment - Probably it needs to be added to https://github.com/jenkinsci/packaging/blob/master/deb/build/debian/control#L11

          Hi,

          We run Jenkins LTS 2.107.2 on Debian 9.
          I installed all packages which have been noted in the previous comments:

          sudo apt-get install libxext6 libxrender1 fontconfig libfontconfig
          

          Unfortunately, we still see the issue.

          • Where is JFreeChart excepted to come from?
            • I suggest from some java package.
          • Is the NoClassDefFound error caused by either:
            • Java class really not available
            • Some required (native) libraries or tools not found (cfr. libfontconfig etc)
          • Which package(s) should we install on Debian 9 then?

          Thank you in advance!

          With best regards,
          Tom.

          Tom Ghyselinck added a comment - Hi, We run Jenkins LTS 2.107.2 on Debian 9. I installed all packages which have been noted in the previous comments: sudo apt-get install libxext6 libxrender1 fontconfig libfontconfig Unfortunately, we still see the issue. Where is JFreeChart excepted to come from? I suggest from some java package. Is the NoClassDefFound error caused by either: Java class really not available Some required (native) libraries or tools not found (cfr. libfontconfig etc) Which package(s) should we install on Debian 9 then? Thank you in advance! With best regards, Tom.

          Hi oleg_nenashev, all,

          On Debian 9, I fixed it by installing libjfreechart-java:

          sudo apt-get install libjfreechart-java

          So this might be another required (or recommended) dependency for the jenkins debian package.

          With best regards,
          Tom.

          Tom Ghyselinck added a comment - Hi oleg_nenashev , all, On Debian 9, I fixed it by installing libjfreechart-java : sudo apt-get install libjfreechart-java So this might be another required (or recommended) dependency for the jenkins debian package. With best regards, Tom.

          Tamas Gal added a comment -

          I am also using Jenkins ver. 2.107.2 on Debian9 and have the same problem, but `libfontconfig` was already installed:

          Note, selecting 'libfontconfig1' instead of 'libfontconfig'
          libfontconfig1 is already the newest version (2.11.0-6.7+b1).

          I installed `libxext6 libxrender1 fontconfig libfontconfig` but it didn't help. After that I also installed `libjfreechart-java` but I still have the same problem.

          This is the top of the stack trace, which is printed when I open the image in a new tab:

          java.lang.NoClassDefFoundError: Could not initialize class org.jfree.chart.JFreeChart at org.jfree.chart.ChartFactory.createStackedAreaChart(ChartFactory.java:1124)

          Tamas Gal added a comment - I am also using Jenkins ver. 2.107.2 on Debian9 and have the same problem, but `libfontconfig` was already installed: Note, selecting 'libfontconfig1' instead of 'libfontconfig' libfontconfig1 is already the newest version (2.11.0-6.7+b1). I installed `libxext6 libxrender1 fontconfig libfontconfig` but it didn't help. After that I also installed `libjfreechart-java` but I still have the same problem. This is the top of the stack trace, which is printed when I open the image in a new tab: java.lang.NoClassDefFoundError: Could not initialize class org.jfree.chart.JFreeChart at org.jfree.chart.ChartFactory.createStackedAreaChart(ChartFactory.java:1124)

          Tamas Gal added a comment -

          Commenting out the `assistive_technologies` line in `/etc/java-8-openjdk/accessibility.properties` solved it.

          Tamas Gal added a comment - Commenting out the `assistive_technologies` line in `/etc/java-8-openjdk/accessibility.properties` solved it.

          Using oracle jdk instead of open jdk solved it for me.

          Manuel Steurer added a comment - Using oracle jdk instead of open jdk solved it for me.

          Not using the -headless install of the openjdk solved this here on ubuntu (apt install openjdk-8-jre).

          Andreas Mandel added a comment - Not using the -headless install of the openjdk solved this here on ubuntu ( apt install openjdk-8-jre ).

          I can confirm on Ubuntu using the openjdk-8-jdk solves this problem.

          Benjamin Brummer added a comment - I can confirm on Ubuntu using the openjdk-8-jdk solves this problem.

          pjdarton added a comment -

          > I can confirm on Ubuntu using the openjdk-8-jdk solves this problem.

          ...so can I, although in my case (I had the headless jre installed initially), I had to reboot my server. Just stopping and restarting the Jenkins service didn't change anything.

          I remain "somewhat disgruntled" about installing the non-headless JRE on a headless server; IMO a headless server should not have any X11 code on it anywhere and installing the non-headless JRE pulled in numerous X11-related packages which offends my sense of neatness ... but my devs don't care as they're just happy they've got their pretty graphs back again, and it didn't take long either

          pjdarton added a comment - > I can confirm on Ubuntu using the openjdk-8-jdk solves this problem. ...so can I, although in my case (I had the headless jre installed initially), I had to reboot my server. Just stopping and restarting the Jenkins service didn't change anything. I remain "somewhat disgruntled" about installing the non-headless JRE on a headless server; IMO a headless server should not have any X11 code on it anywhere and installing the non-headless JRE pulled in numerous X11-related packages which offends my sense of neatness ... but my devs don't care as they're just happy they've got their pretty graphs back again, and it didn't take long either

            Unassigned Unassigned
            daniel15 Daniel Lo Nigro
            Votes:
            8 Vote for this issue
            Watchers:
            15 Start watching this issue

              Created:
              Updated: