jcaptcha无法连接X11问题解决

问题描述:

tomcat启动时报异常:

Can't connect to X11 window server using 'localhost:10.0' as the value of the DISPLAY variable.

这是个常见问题,在jcaptcha的faq中有解答,地址:http://jcaptcha.octo.com/confluence/display/general/FAQ


将-Djava.awt.headless=true加入到tomcat的bin/catalina.sh文件中,需要讲究如下技巧:

有人的做法是修改六处, http://www.wardking.com/2011/09/jsp-captcha-error-on-tomcat-with-apache/,实际上没有必要,我们只需要设置好CATALINA_OPTS变量即可,但要注意设置位置,必须是在使用前设置,我是在if [ "$1" = "debug" ] ; then这一行前面设置的,设置行为CATALINA_OPTS="$CATALINA_OPTS -Djava.awt.headless=true"


你可能感兴趣的:(tomcat,server)