小工具知识网

当前位置: 首页 > 行业知识 > Java读取本地字体 缺失 Fontconfig head is null

行业知识

Java读取本地字体 缺失 Fontconfig head is null

2026-12-06 01:16:34 来源:互联网转载

异常问题

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

上一篇:云服务器谁便宜好用

下一篇:揭秘禁止下载网站内容的下载方法与法律风险详解!