This article is a mirror article of machine translation, please click here to jump to the original article.

View: 9444|Reply: 1

Docker POI error exception solution

[Copy link]
Posted on 2021-11-9 09:19:08 | | | |
When using POI to implement excel import and export, the local open environment is normal, but when packaged as a docker image to start, the error is as follows:



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.canDisplayUpTo(Font.java:2060)
        at java.awt.font.TextLayout.singleFont(TextLayout.java:470)
        at java.awt.font.TextLayout. <init>(TextLayout.java:531)
        at org.apache.poi.ss.util.SheetUtil.getDefaultCharWidth(SheetUtil.java:285)
        at org.apache.poi.ss.util.SheetUtil.getColumnWidth(SheetUtil.java:259)
        at org.apache.poi.ss.util.SheetUtil.getColumnWidth(SheetUtil.java:244)
        at org.apache.poi.xssf.usermodel.XSSFSheet.autoSizeColumn(XSSFSheet.java:523)
        at org.apache.poi.xssf.usermodel.XSSFSheet.autoSizeColumn(XSSFSheet.java:505)

solution

Replacing the base image, I originally used openjdk:8-jdk-alpine, then changed to:openjdk:8u312-oraclelinux8, the problem is solved, and the POI package can be used normally.

Dockerfile



(End)




Previous:The file or folder does not exist when the Docker volume is mounted
Next:Java modifies the configuration file of the war package
Posted on 2021-11-11 08:49:48 |
Disclaimer:
All software, programming materials or articles published by Code Farmer Network are only for learning and research purposes; The above content shall not be used for commercial or illegal purposes, otherwise, users shall bear all consequences. The information on this site comes from the Internet, and copyright disputes have nothing to do with this site. You must completely delete the above content from your computer within 24 hours of downloading. If you like the program, please support genuine software, purchase registration, and get better genuine services. If there is any infringement, please contact us by email.

Mail To:help@itsvse.com