Exception in thread “http-bio-8080-exec-6” java.lang.InternalError: Can’t connect to X11 window server using ‘localhost:10.0’ as the value of the DISPLAY variable
在centos上部署tomcat的时候,Excel表导出的时候会报这个错误,找了很多没找到解决方案,我是用宝塔搭建javaweb的,tomcat也是通过宝塔安装的,百度了很多关于这个报错问题,都是说配置tomcat/bin/catalina.sh文件,是没错,是需要配置,但是很多文章忘了一步就是启动tomcat的时候要写 java -Djava.awt.headless=true
有两个步骤
-
tomcat/bin/catalina.sh 头部写 JAVA_OPTS=-Djava.awt.headless=true
-
在启动tomcat前执行 java -Djava.awt.headless=true ,执行完后再启动tomcat
就这两个步骤,这篇文章希望对您有帮助