gpt4 book ai didi

java - NoClassDefFoundError : Could not initialize class sun. awt.X11FontManager

转载 作者:行者123 更新时间:2023-12-01 10:59:14 27 4
gpt4 key购买 nike

当我们从 Oracle JDK-8 迁移到 Open JDK-11 时,Apache POI excel 生成有问题
已经试过了-Djava.awt.headless=true

org.springframework.web.util.NestedServletException: Handler dispatch failed; nested exception is java.lang.NoClassDefFoundError: Could not initialize class sun.awt.X11FontManager
at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:1053)
at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:942)
at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:998)
at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:901)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:660)
at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:875)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:741)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:231)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)```

最佳答案

如果您使用的是 docker 'slim images'在 openjdk 中,图像不再包含包“fontconfig”和“libfreetype6”。

查看docker file中的差异openjdk:11-slim 和 docker file openjdk:8-slim。

你可以选择另一个 docker 镜像(例如 openjdk:11-windowsservercore ),或者自己在你的 docker 文件中安装这些包:

RUN apt-get update; apt-get install -y fontconfig libfreetype6 

关于java - NoClassDefFoundError : Could not initialize class sun. awt.X11FontManager,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55454036/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com