异常问题

2023-11-30 02:46:36.395 [http-nio-13700-exec-3] ERROR o.a.c.c.C.[.[.[/xxx].[dispatcherServlet] - Servlet.service() for servlet [dispatcherServlet] in context with path [/xxx] threw exception [Request processing failed; nested exception is java.lang.RuntimeException: Fontconfig head is null, check your fonts or fonts configuration] with root causejava.lang.RuntimeException: Fontconfig head is null, check your fonts or fonts configuration

环境

新环境 JDK21

java 21.0.1 2023-10-17 LTS
Java™ SE Runtime Environment (build 21.0.1+12-LTS-29)
Java HotSpot™ 64-Bit Server VM (build 21.0.1+12-LTS-29, mixed mode, sharing)

问题原因

项目Spring Boot2.x,JDK1.8,后来改成JDK21,部署之后导出excel,出现该异常

解决

1、服务器配置

在服务器上安装FontConfig组件:

apt-get install -y fontconfigfc-cache --force

鸣谢

  • https://blog.csdn.net/weixin_42074377/article/details/108281172