欢迎光临
一个废柴的博客

解决Linux平台JFreeChart报错:java.lang.NoClassDefFoundError: Could not initialize class org.jfree.chart.JFreeChart

在windows平台上的Idea正常运行的JFreeChart图表,在Linux上部署之后报下面的错误:

org.springframework.web.util.NestedServletException: Handler dispatch failed; nested exception is java.lang.NoClassDefFoundError: Could not initialize class org.jfree.chart.JFreeChart
    at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:978)
    at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:897)
    at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:970)
    at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:861)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:624)
    at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:846)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:731)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
    at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)

解决办法:修改tomcat的bin目录下的catalina.sh文件,增加一行:

CATALINA_OPTS=-Djava.awt.headless=true

如下图:

Could-not-initialize-class-org.jfree.chart.JFreeChart.jpg

参考:

  1. http://abloz.com/%E6%8A%80%E6%9C%AF/2016/01/29/jenkins-does-not-display-statistics/;
  2. http://kavy.iteye.com/blog/2029611;

评论 抢沙发

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址