验证码无法显示:Could not initialize class sun.awt.X11GraphicsEnvironment 解决方案

解决方案:

   在tomcat配置文件catalina.sh文件中添加 CATALINA_OPTS="-Djava.awt.headless=true"

catalina.sh添加之后如下:

#   LOGGING_CONFIG  (Optional) Override Tomcat's logging config file
#                   Example (all one line)
#                   LOGGING_CONFIG="-Djava.util.logging.config.file=$CATALINA_BASE/conf/logging.properties"
#
#   LOGGING_MANAGER (Optional) Override Tomcat's logging manager
#                   Example (all one line)
#                   LOGGING_MANAGER="-Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager"
#
# $Id: catalina.sh 1146097 2011-07-13 15:25:05Z markt $
# -----------------------------------------------------------------------------
 
JAVA_OPTS="-Xms512m -Xmx19500m"
CATALINA_OPTS="-Djava.awt.headless=true"
# OS specific support.  $var _must_ be set to either true or false.
cygwin=false
os400=false
darwin=false
case "`uname`" in
CYGWIN*) cygwin=true;;
OS400*) os400=true;;
Darwin*) darwin=true;;
esac
 
# resolve links - $0 may be a softlink
PRG="$0"
 
while [ -h "$PRG" ]; do

————————————————
版权声明:本文为CSDN博主「偶尔上线的玩家」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.csdn.net/yibo924/article/details/81456594

posted @ 2021-03-15 11:17  jiftle  阅读(186)  评论(0编辑  收藏  举报