zoukankan      html  css  js  c++  java
  • openjdk:8u22-jre-alpine在java开发中的NullPointerException错误解决方案

    问题描述

    ** 在SpringBoot项目中使用了Ureport报表组件, 打包发布部署到docker中启动报错 **

    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)
    

    问题解决

    ** 参考资料地址: http://https://www.jianshu.com/p/e39ee0cad05b **

    FROM java:8-alpine
    RUN echo -e "https://mirror.tuna.tsinghua.edu.cn/alpine/v3.4/main
    
    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/*
    

    使用此Dockerfile重新build一个java镜像即可

  • 相关阅读:
    LeetCode 110: Balanced Binary Tree
    LeetCode 101: Symmetric Tree
    LeetCode 100: Same Tree
    Cannot resolve plugin org.apache.maven.plugins:maven-site-plugin:3.3
    idea 创建springboot项目失败
    spring5中log4j2.xml文件的配置信息
    CPU占用过高定位分析
    GC基础参数 -XX:+PrintGCDetails
    idea springboot项目报错:Failed to configure a DataSource: 'url' attribute is not specified and no embedded datasource could be configured
    git克隆指定分支到指定文件夹(仓库不存在,自动创建)
  • 原文地址:https://www.cnblogs.com/famary/p/11329236.html
Copyright © 2011-2022 走看看