在初始化org.apache.poi.ss.usermodel.Sheet
期间发生错误
我可以解决这个问题,以防止Linux上的OpenJdk失败。
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.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:275)
at org.apache.poi.xssf.streaming.AutoSizeColumnTracker.<init>(AutoSizeColumnTracker.java:117)
at org.apache.poi.xssf.streaming.SXSSFSheet.<init>(SXSSFSheet.java:79)
at org.apache.poi.xssf.streaming.SXSSFWorkbook.createAndRegisterSXSSFSheet(SXSSFWorkbook.java:656)
at org.apache.poi.xssf.streaming.SXSSFWorkbook.createSheet(SXSSFWorkbook.java:677)
at org.apache.poi.xssf.streaming.SXSSFWorkbook.createSheet(SXSSFWorkbook.java:83)
at com.jthink.songkong.reports.spreadsheet.Worksheet.<init>(Worksheet.java:24)
更新
根据评论在lib
中找不到任何字体文件[root @ N1-ZS10 lib] #ls -l </ p>
total 70948
drwxrwxr-x 4 root root 4096 Mar 29 15:09 aarch32
drwxrwxr-x 2 root root 4096 Mar 29 11:28 applet
-rw-rw-r-- 1 root root 2375 Mar 29 11:28 calendars.properties
-rw-rw-r-- 1 root root 3135391 Mar 29 11:28 charsets.jar
-rw-rw-r-- 1 root root 84311 Mar 29 11:28 classlist
drwxrwxr-x 2 root root 4096 Mar 29 15:09 cmm
-rw-rw-r-- 1 root root 5916 Mar 29 11:28 content-types.properties
-r--r--r-- 1 root root 4122 Mar 29 11:28 currency.data
drwxrwxr-x 2 root root 4096 Mar 29 15:09 ext
-rw-rw-r-- 1 root root 3901 Mar 29 11:28 flavormap.properties
-rw-rw-r-- 1 root root 14959 Mar 29 11:28 hijrah-config-umalqura.properties
drwxrwxr-x 3 root root 4096 Mar 29 15:08 images
-rw-rw-r-- 1 root root 95642 Mar 29 11:28 jce.jar
-rwxrwxr-x 1 root root 15917 Mar 29 11:28 jexec
-rw-rw-r-- 1 root root 647046 Mar 29 11:28 jsse.jar
-rw-rw-r-- 1 root root 4226 Mar 29 11:28 jvm.hprof.txt
-rw-rw-r-- 1 root root 2455 Mar 29 11:28 logging.properties
drwxrwxr-x 2 root root 4096 Mar 29 15:09 management
-rw-rw-r-- 1 root root 381 Mar 29 11:28 management-agent.jar
-rw-rw-r-- 1 root root 1922 Mar 29 11:28 meta-index
-rw-rw-r-- 1 root root 4464 Mar 29 11:28 net.properties
-rw-rw-r-- 1 root root 3793 Mar 29 11:28 psfont.properties.ja
-rw-rw-r-- 1 root root 11390 Mar 29 11:28 psfontj2d.properties
-rw-rw-r-- 1 root root 3509545 Mar 29 11:28 resources.jar
-rw-rw-r-- 1 root root 64833198 Mar 29 11:28 rt.jar
drwxrwxr-x 2 root root 4096 Mar 29 15:08 security
-rw-rw-r-- 1 root root 1210 Mar 29 11:28 sound.properties
-rw-rw-r-- 1 root root 104311 Mar 29 11:28 tzdb.dat
答案 0 :(得分:1)
只需在 Dockerfiel 中添加以下内容
RUN apk add --no-cache fontconfig ttf-dejavu
或者如果是机器,执行如下
apk add --no-cache fontconfig ttf-dejavu
答案 1 :(得分:0)
出于完整性考虑,我在此处添加Paul Taylor的答案:
Openjdk取决于我没有安装的系统字体,但是我 发现在jre的lib文件夹中创建一个fonts文件夹,并且 将一些字体复制到其中可解决问题