您的位置:首页 > 编程语言 > Java开发

java.lang.NoClassDefFoundError: Could not initialize class org.jfree.ch

2016-11-15 23:21 1071 查看
On linux servers, some people have reported a problem after a successful install, once their server is in use. They report that Web-CAT produces unexpected exceptions when you visit any pages that contain charts, such as those graphing student results. The Web-CAT exception page cites the following Java exception:Error: java.lang.NoClassDefFoundError
Reason: Could not initialize class org.jfree.chart.JFreeChartOr possibly:Error: java.lang.NoClassDefFoundError
Reason: Could not initialize class sun.awt.X11GraphicsEnvironmentIf this occurs, check the environment variables for the pseudo-user under which Tomcat is running. Check for any definition for the DISPLAY environment variable that is visible to Tomcat, an remove any such definitions.This problem appears to be caused internally in Sun's AWT implementation, where Java is trying to connect to the X11 display identified by the DISPLAY environment variable, but the user id under which Tomcat is running does not have permission to connect (or there is no active DISPLAY). Removing the environment variable setting for the Tomcat user will fix this problem. You may also need to add -Djava.awt.headless=true to Tomcat's startup arguments as well. eq: I did a ps -ef | grep headless command to look at how tomcat was started and I found that this was passed in instead (with an extra ? on the end):

-Djava.awt.headless=true?if don't have it,we should:export CATALINA_OPTS="-Djava.awt.headless=true"
-------------------------------------------------------------Headless模式是系统的一种配置模式。在该模式下,系统缺少了显示设备、键盘或鼠标。Headless模式虽然不是我们愿意见到的,但事实上我们却常常需要在该模式下工作,尤其是服务器端程序开发者。因为服务器(如提供Web服务的主机)往往可能缺少前述设备,但又需要使用他们提供的功能,生成相应的数据,以提供给客户端(如浏览器所在的配有相关的显示设备、键盘和鼠标的主机)。 最后,重启Tomcat服务器:sudo ./shutdown.sh sudo ./startup.sh
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
相关文章推荐