NoClassDefFoundError: Could not initialize class sun.awt.X11FontManager

Purna :

when we migrated from Oracle JDK-8 to Open JDK-11, Apache POI excel generation has issues

tried already "-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)

Purna :

The underlying issues is something else

I just created a simple class which does class loading of X11FontManager and when I ran it complained

unable to link "libfreetype6"

once I installed it using

apt-get install libfreetype6

started throwing could not link "libfontconfig1.so"

apt-get install libfontconfig1

that fixed the issue

Read this and understood few things https://medium.com/azulsystems/using-jlink-to-build-java-runtimes-for-non-modular-applications-9568c5e70ef4

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=69168&siteId=1