at sun.awt.FontConfiguration.getVersion( [How to Solve]


Graphic verification codes need to be used in the project. There is no problem with local use. The following problems occur when deployed online:

java.lang.NullPointerException: null
        at sun.awt.FontConfiguration.getVersion(
        at sun.awt.FontConfiguration.readFontConfigFile(
        at sun.awt.FontConfiguration.init(
        at sun.awt.X11FontManager.createFontConfiguration(
        at sun.font.SunFontManager$
        at Method)
        at sun.font.SunFontManager.<init>(
        at sun.awt.FcFontManager.<init>(
        at sun.awt.X11FontManager.<init>(
        at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
        at sun.reflect.NativeConstructorAccessorImpl.newInstance(
        at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(
        at java.lang.reflect.Constructor.newInstance(
        at java.lang.Class.newInstance(
        at sun.font.FontManagerFactory$
        at Method)
        at sun.font.FontManagerFactory.getInstance(

The main reason is the font problem. The modification scheme is as follows:

You only need to add the following item in the docker deployment file of the project:

RUN apk add –update ttf-dejavu fontconfig

The configuration file after adding is as follows:

FROM openjdk:8-jdk-alpine
ADD xx.jar app.jar
RUN apk add --update ttf-dejavu fontconfig
ENTRYPOINT ["java","","-jar","/app.jar"]

Similar Posts: