java导出excel:Could not initialize class sun.awt.X11GraphicsEnvironment
程序员文章站
2022-07-14 23:00:18
...
项目背景
前两天给客户本地化部署了一个项目,在验证 导出excel的时候提示错误:
Could not initialize class sun.awt.X11GraphicsEnvironment
我们excel导出给前端返回数据流,在下载的时候提示错误,项目在我们本地环境是没有问题的,所以猜测是配置的问题,跟踪代码发现是在创建sheet的时候提示错误
SXSSFWorkbook workbook = new SXSSFWorkbook(-1);
SXSSFSheet sheet = workbook.createSheet(sheetName);
解决方案:
修改${TOMCAT_HOME}/bin/catalina.sh (windows修改catalina.bat) 里加上一句 “CATALINA_OPTS=-Djava.awt.headless=true
上一篇: 安装RocketMQ控制台
下一篇: Pycharm使用sns.distplot警告FutureWarning: `distplot` is a deprecated function and will be removed in a
推荐阅读
-
【J2SE】java.lang.NoClassDefFoundError: Could not initialize class xxx 原因
-
java.lang.NoClassDefoundError:Could not initialize class sun.awt.X11GraphicsEnvironment异常
-
Java:提示Could not initialize class sun.awt.X11GraphicsEnvironment
-
java导出excel:Could not initialize class sun.awt.X11GraphicsEnvironment
-
Caused by: java.lang.NoClassDefFoundError: Could not initialize class sun.awt.X11GraphicsEnvironment
-
Jeecg部署服务器图片不显示,报java.lang.NoClassDefFoundError: Could not initialize class sun.awt.X11GraphicsEnvir
-
【J2SE】java.lang.NoClassDefFoundError: Could not initialize class xxx 原因