Fontconfig head is null, check your fonts or fonts configuration 生产环境Centos服务器报错 本地没问题

hutool Excel 导出 Caused by: java.lang.RuntimeException: Fontconfig head is null, check your fonts or fonts configuration


Caused by: java.lang.RuntimeException: Fontconfig head is null, check your fonts or fonts configuration
        at java.desktop/sun.awt.FontConfiguration.getVersion(FontConfiguration.java:1269) ~[na:na]
        at java.desktop/sun.awt.FontConfiguration.readFontConfigFile(FontConfiguration.java:224) ~[na:na]
        at java.desktop/sun.awt.FontConfiguration.init(FontConfiguration.java:106) ~[na:na]
        at java.desktop/sun.awt.X11FontManager.createFontConfiguration(X11FontManager.java:706) ~[na:na]
        at java.desktop/sun.font.SunFontManager$2.run(SunFontManager.java:358) ~[na:na]
        at java.desktop/sun.font.SunFontManager$2.run(SunFontManager.java:315) ~[na:na]
        at java.base/java.security.AccessController.doPrivileged(AccessController.java:318) ~[na:na]
        at java.desktop/sun.font.SunFontManager.<init>(SunFontManager.java:315) ~[na:na]
        at java.desktop/sun.awt.FcFontManager.<init>(FcFontManager.java:35) ~[na:na]
        at java.desktop/sun.awt.X11FontManager.<init>(X11FontManager.java:56) ~[na:na]
        ... 92 common frames omitted

是因为使用的JDK不支持awt包下的字体

解决方法:

安装FontConfig组件即可

yum install -y fontconfig

或者将字体文件放在项目目录下 加载进来!!

posted @ 2024-04-12 11:02  趙小傑  阅读(1861)  评论(0编辑  收藏  举报