8u111-jdk-alpine 字体缺少FontConfiguration的NullPointerException错误解决方案
1、异常
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 | java.lang.NullPointerException at sun.awt.FontConfiguration.getVersion(FontConfiguration.java: 1264 ) at sun.awt.FontConfiguration.readFontConfigFile(FontConfiguration.java: 219 ) at sun.awt.FontConfiguration.init(FontConfiguration.java: 107 ) at sun.awt.X11FontManager.createFontConfiguration(X11FontManager.java: 774 ) at sun.font.SunFontManager$ 2 .run(SunFontManager.java: 431 ) at java.security.AccessController.doPrivileged(Native Method) at sun.font.SunFontManager.<init>(SunFontManager.java: 376 ) at sun.awt.FcFontManager.<init>(FcFontManager.java: 35 ) at sun.awt.X11FontManager.<init>(X11FontManager.java: 57 ) at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java: 62 ) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java: 45 ) at java.lang.reflect.Constructor.newInstance(Constructor.java: 423 ) at java.lang.Class.newInstance(Class.java: 442 ) at sun.font.FontManagerFactory$ 1 .run(FontManagerFactory.java: 83 ) at java.security.AccessController.doPrivileged(Native Method) at sun.font.FontManagerFactory.getInstance(FontManagerFactory.java: 74 ) at java.awt.Font.getFont2D(Font.java: 491 ) at java.awt.Font.access$ 000 (Font.java: 224 ) at java.awt.Font$FontAccessImpl.getFont2D(Font.java: 228 ) at sun.font.FontUtilities.getFont2D(FontUtilities.java: 180 ) at sun.font.StandardGlyphVector.initFontData(StandardGlyphVector.java: 1126 ) at sun.font.StandardGlyphVector.init(StandardGlyphVector.java: 1115 ) at sun.font.StandardGlyphVector.<init>(StandardGlyphVector.java: 167 ) at java.awt.Font.createGlyphVector(Font.java: 2545 ) at nl.captcha.text.renderer.DefaultWordRenderer.render(Unknown Source) at nl.captcha.Captcha$Builder.addText(Unknown Source) at com.liferay.portal.captcha.simplecaptcha.SimpleCaptchaImpl.getSimpleCaptcha(SimpleCaptchaImpl.java: 243 ) at com.liferay.portal.captcha.simplecaptcha.SimpleCaptchaImpl.serveImage(SimpleCaptchaImpl.java: 159 ) at com.liferay.portal.captcha.CaptchaImpl.serveImage(CaptchaImpl.java: 100 ) at com.liferay.portal.kernel.captcha.CaptchaUtil.serveImage(CaptchaUtil.java: 78 ) at com.liferay.portal.captcha.CaptchaPortletAction.serveResource(CaptchaPortletAction.java: 42 ) |
2、解决,在dockerFile中添加
1 2 3 4 5 6 | # 缺少的字体 RUN echo -e "https: //mirror .tuna.tsinghua.edu.cn /alpine/v3 .4 /main \n\ https: //mirror .tuna.tsinghua.edu.cn /alpine/v3 .4 /community " > /etc/apk/repositories RUN apk --update add curl bash ttf-dejavu && \ rm -rf /var/cache/apk/ * |
3、结果
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 基于Microsoft.Extensions.AI核心库实现RAG应用
· Linux系列:如何用heaptrack跟踪.NET程序的非托管内存泄露
· 开发者必知的日志记录最佳实践
· SQL Server 2025 AI相关能力初探
· Linux系列:如何用 C#调用 C方法造成内存泄露
· 无需6万激活码!GitHub神秘组织3小时极速复刻Manus,手把手教你使用OpenManus搭建本
· Manus爆火,是硬核还是营销?
· 终于写完轮子一部分:tcp代理 了,记录一下
· 别再用vector<bool>了!Google高级工程师:这可能是STL最大的设计失误
· 单元测试从入门到精通