OpenJdk 11 java.desktop InvocationTargetException from FileFormat.getJavaDimension

0 votes
asked Jun 25 in Bug by Sjoerd Talsma

I encountered the exception when running JavaDoc with UMLDoclet 2.0.4 / PlantUML 1.2019.06 in a docker image with OpenJDK 11.0.2.9.

UMLDoclet bug report with stacktrace: https://github.com/talsma-ict/umldoclet/issues/184

Relevant part of the stacktrace:

[ERROR] javadoc: error - fatal error encountered: java.lang.InternalError: java.lang.reflect.InvocationTargetException
[ERROR] javadoc: error - Please file a bug against the javadoc tool via the Java bug reporting page
[ERROR] (http://bugreport.java.com) after checking the Bug Database (http://bugs.java.com)
[ERROR] for duplicates. Include error messages and the following diagnostic in your report. Thank you.
[ERROR] java.lang.InternalError: java.lang.reflect.InvocationTargetException
[ERROR] 	at java.desktop/sun.font.FontManagerFactory$1.run(FontManagerFactory.java:86)
[ERROR] 	at java.base/java.security.AccessController.doPrivileged(Native Method)
[ERROR] 	at java.desktop/sun.font.FontManagerFactory.getInstance(FontManagerFactory.java:74)
[ERROR] 	at java.desktop/sun.font.SunFontManager.getInstance(SunFontManager.java:247)
[ERROR] 	at java.desktop/sun.font.FontDesignMetrics.getMetrics(FontDesignMetrics.java:265)
[ERROR] 	at java.desktop/sun.java2d.SunGraphics2D.getFontMetrics(SunGraphics2D.java:864)
[ERROR] 	at net.sourceforge.plantuml.FileFormat.getJavaDimension(FileFormat.java:112)
[ERROR] 	at net.sourceforge.plantuml.FileFormat.access$000(FileFormat.java:52)
[ERROR] 	at net.sourceforge.plantuml.FileFormat$1.calculateDimension(FileFormat.java:104)
[ERROR] 	at net.sourceforge.plantuml.creole.AtomText.calculateDimension(AtomText.java:191)
[ERROR] 	at net.sourceforge.plantuml.creole.Sea.add(Sea.java:51)
[ERROR] 	at net.sourceforge.plantuml.creole.SheetBlock1.initMap(SheetBlock1.java:110)
[ERROR] 	at net.sourceforge.plantuml.creole.SheetBlock1.calculateDimension(SheetBlock1.java:152)
[ERROR] 	at net.sourceforge.plantuml.creole.SheetBlock2.calculateDimension(SheetBlock2.java:70)
[ERROR] 	at net.sourceforge.plantuml.graphic.TextBlockVertical2.calculateDimension(TextBlockVertical2.java:70)
[ERROR] 	at net.sourceforge.plantuml.svek.GeneralImageBuilder.printGroup(GeneralImageBuilder.java:508)
[ERROR] 	at net.sourceforge.plantuml.svek.GeneralImageBuilder.printGroups(GeneralImageBuilder.java:493)
[ERROR] 	at net.sourceforge.plantuml.svek.GeneralImageBuilder.buildImage(GeneralImageBuilder.java:143)
[ERROR] 	at net.sourceforge.plantuml.svek.CucaDiagramFileMakerSvek.createFileInternal(CucaDiagramFileMakerSvek.java:100)
[ERROR] 	at net.sourceforge.plantuml.svek.CucaDiagramFileMakerSvek.createFile(CucaDiagramFileMakerSvek.java:66)
[ERROR] 	at net.sourceforge.plantuml.cucadiagram.CucaDiagram.exportDiagramInternal(CucaDiagram.java:374)
[ERROR] 	at net.sourceforge.plantuml.classdiagram.ClassDiagram.exportDiagramInternal(ClassDiagram.java:189)
[ERROR] 	at net.sourceforge.plantuml.UmlDiagram.exportDiagramNow(UmlDiagram.java:197)
[ERROR] 	at net.sourceforge.plantuml.AbstractPSystem.exportDiagram(AbstractPSystem.java:130)
[ERROR] 	at net.sourceforge.plantuml.SourceStringReader.outputImage(SourceStringReader.java:149)
[ERROR] 	at net.sourceforge.plantuml.SourceStringReader.outputImage(SourceStringReader.java:121)
[ERROR] 	at nl.talsmasoftware.umldoclet.uml.Diagram.renderDiagramFile(Diagram.java:170)
[ERROR] 	at nl.talsmasoftware.umldoclet.uml.Diagram.render(Diagram.java:129)
[ERROR] 	at java.base/java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:177)
[ERROR] 	at java.base/java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:195)
[ERROR] 	at java.base/java.util.Iterator.forEachRemaining(Iterator.java:133)
[ERROR] 	at java.base/java.util.Spliterators$IteratorSpliterator.forEachRemaining(Spliterators.java:1801)
[ERROR] 	at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:484)
[ERROR] 	at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:474)
[ERROR] 	at java.base/java.util.stream.StreamSpliterators$WrappingSpliterator.forEachRemaining(StreamSpliterators.java:312)
[ERROR] 	at java.base/java.util.stream.Streams$ConcatSpliterator.forEachRemaining(Streams.java:734)
[ERROR] 	at java.base/java.util.stream.ReferencePipeline$Head.forEach(ReferencePipeline.java:658)
[ERROR] 	at nl.talsmasoftware.umldoclet.UMLDoclet.run(UMLDoclet.java:88)
[ERROR] 	at jdk.javadoc/jdk.javadoc.internal.tool.Start.parseAndExecute(Start.java:582)
[ERROR] 	at jdk.javadoc/jdk.javadoc.internal.tool.Start.begin(Start.java:431)
[ERROR] 	at jdk.javadoc/jdk.javadoc.internal.tool.Start.begin(Start.java:344)
[ERROR] 	at jdk.javadoc/jdk.javadoc.internal.tool.Main.execute(Main.java:63)
[ERROR] 	at jdk.javadoc/jdk.javadoc.internal.tool.Main.main(Main.java:52)
[ERROR] Caused by: java.lang.reflect.InvocationTargetException
[ERROR] 	at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
[ERROR] 	at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
[ERROR] 	at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
[ERROR] 	at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:490)
[ERROR] 	at java.desktop/sun.font.FontManagerFactory$1.run(FontManagerFactory.java:84)
[ERROR] 	... 42 more
[ERROR] Caused by: java.lang.NullPointerException
[ERROR] 	at java.desktop/sun.awt.FontConfiguration.getVersion(FontConfiguration.java:1262)
[ERROR] 	at java.desktop/sun.awt.FontConfiguration.readFontConfigFile(FontConfiguration.java:225)
[ERROR] 	at java.desktop/sun.awt.FontConfiguration.init(FontConfiguration.java:107)
[ERROR] 	at java.desktop/sun.awt.X11FontManager.createFontConfiguration(X11FontManager.java:719)
[ERROR] 	at java.desktop/sun.font.SunFontManager$2.run(SunFontManager.java:367)
[ERROR] 	at java.base/java.security.AccessController.doPrivileged(Native Method)
[ERROR] 	at java.desktop/sun.font.SunFontManager.<init>(SunFontManager.java:312)
[ERROR] 	at java.desktop/sun.awt.FcFontManager.<init>(FcFontManager.java:35)
[ERROR] 	at java.desktop/sun.awt.X11FontManager.<init>(X11FontManager.java:56)
[ERROR] 	... 47 more

1 Answer

0 votes
answered Jun 25 by plantuml (198,780 points)

It's difficult to answer, but it looks like a font issue somewhere.

The key message seems to be:

Caused by: java.lang.NullPointerException at java.desktop/sun.awt.FontConfiguration.getVersion(FontConfiguration.java:1262)

Maybe it's the same as https://github.com/AdoptOpenJDK/openjdk-docker/issues/75

Or maybe you can read info about X11 on http://plantuml.com/faq

commented Jun 25 by Sjoerd talsma
Thanks for this pointer; it sure looks eerily similar.

I'll try applying the workaround that is mentioned in that issue and report back here!
commented 2 days ago by Sjoerd Talsma

Unfortunately the workarounds described in the above AdoptOpenJDK issue did not resolve my build problem. Switching from the alpine image to the slim (ubuntu-based) docker image did resolve the problem though.

So I'll be closing the issue as a known-issue with AdoptOpenJDK alpine docker images.

...