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.JFreeChart
Or possibly:
Error: java.lang.NoClassDefFoundError
Reason: Could not initialize class sun.awt.X11GraphicsEnvironment
If 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"
本文介绍了解决在Linux服务器上运行Web-CAT时出现的图表显示异常问题。该问题是由于Java试图连接到由DISPLAY环境变量标识的X11显示但因权限不足而引发。文中提供了解决方案,包括移除Tomcat用户的DISPLAY环境变量设置,并向Tomcat启动参数中添加-Djava.awt.headless=true。

被折叠的 条评论
为什么被折叠?



