java.lang.NoClassDefFoundError: Could not initialize class net.sourceforge.plantuml.klimt.font.UFont

0 votes
asked Aug 9, 2023 in Bug by Pawel

Hello.

I get an error, that states that "I should send a mail to plantuml@gmail.com or post to https://plantuml.com/qa with this log (V1.2023.10)"

I cannot generate some diagrams, with the direct reason being:

Caused by: java.lang.RuntimeException: Fontconfig head is null, check your fonts or fonts configuration

Full stacktrace below.
How can I sovle this issue ?

If it's a problem fiel diagram definition - why is this thrown as an Error and not regular Exception, so that it can be handled ?

Error java.lang.InternalError: java.lang.reflect.InvocationTargetException

java.lang.InternalError: java.lang.reflect.InvocationTargetException

at java.desktop/sun.font.FontManagerFactory$1.run(FontManagerFactory.java:87)

at java.base/java.security.AccessController.doPrivileged(AccessController.java:318)

at java.desktop/sun.font.FontManagerFactory.getInstance(FontManagerFactory.java:75)

at java.desktop/sun.java2d.SunGraphicsEnvironment.getFontManagerForSGE(SunGraphicsEnvironment.java:137)

at java.desktop/sun.java2d.SunGraphicsEnvironment.getAvailableFontFamilyNames(SunGraphicsEnvironment.java:171)

at java.desktop/sun.java2d.SunGraphicsEnvironment.getAvailableFontFamilyNames(SunGraphicsEnvironment.java:199)

at java.desktop/sun.java2d.HeadlessGraphicsEnvironment.getAvailableFontFamilyNames(HeadlessGraphicsEnvironment.java:80)

at net.sourceforge.plantuml.klimt.font.UFont.<clinit>(UFont.java:59)

at net.sourceforge.plantuml.klimt.creole.legacy.CreoleParser.checkColor(CreoleParser.java:179)

at net.sourceforge.plantuml.klimt.creole.Display.createFoo(Display.java:174)

at net.sourceforge.plantuml.utils.BlocLines.toDisplay(BlocLines.java:104)

at net.sourceforge.plantuml.command.note.CommandFactoryTipOnEntity.executeInternal(CommandFactoryTipOnEntity.java:199)

at net.sourceforge.plantuml.command.note.CommandFactoryTipOnEntity.access$000(CommandFactoryTipOnEntity.java:70)

at net.sourceforge.plantuml.command.note.CommandFactoryTipOnEntity$1.executeNow(CommandFactoryTipOnEntity.java:161)

at net.sourceforge.plantuml.command.note.CommandFactoryTipOnEntity$1.executeNow(CommandFactoryTipOnEntity.java:137)

at net.sourceforge.plantuml.command.CommandMultilines2.execute(CommandMultilines2.java:112)

at net.sourceforge.plantuml.command.ProtectedCommand.execute(ProtectedCommand.java:57)

at net.sourceforge.plantuml.AbstractPSystem.executeCommand(AbstractPSystem.java:177)

at net.sourceforge.plantuml.command.PSystemCommandFactory.executeFewLines(PSystemCommandFactory.java:125)

at net.sourceforge.plantuml.command.PSystemCommandFactory.createSystem(PSystemCommandFactory.java:108)

at net.sourceforge.plantuml.PSystemBuilder.createPSystem(PSystemBuilder.java:146)

at net.sourceforge.plantuml.BlockUml.getDiagram(BlockUml.java:188)

at net.sourceforge.plantuml.SourceStringReader.outputImage(SourceStringReader.java:161)

at com.mb.docs.diagrams.DiagramRenderer.renderDiagram(DiagramRenderer.java:39)

at com.mb.docs.diagrams.DiagramRenderer.tryRenderDiagram(DiagramRenderer.java:26)

at java.base/java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:197)

at java.base/java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:197)

at java.base/java.util.AbstractList$RandomAccessSpliterator.forEachRemaining(AbstractList.java:720)

at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:509)

at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:499)

at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:575)

at java.base/java.util.stream.AbstractPipeline.evaluateToArrayNode(AbstractPipeline.java:260)

at java.base/java.util.stream.ReferencePipeline.toArray(ReferencePipeline.java:616)

at java.base/java.util.stream.ReferencePipeline.toArray(ReferencePipeline.java:622)

at java.base/java.util.stream.ReferencePipeline.toList(ReferencePipeline.java:627)




You should send a mail to plantuml@gmail.com or post to https://plantuml.com/qa with this log (V1.2023.10)


java.lang.NoClassDefFoundError: Could not initialize class net.sourceforge.plantuml.klimt.font.UFont

at net.sourceforge.plantuml.klimt.shape.GraphicStrings.sansSerif14(GraphicStrings.java:123)

at net.sourceforge.plantuml.error.PSystemError.getGraphicalFormatted(PSystemError.java:147)

at net.sourceforge.plantuml.error.PSystemError.getRootDrawable(PSystemError.java:249)

at net.sourceforge.plantuml.PlainDiagram.exportDiagramNow(PlainDiagram.java:64)

at net.sourceforge.plantuml.error.PSystemError.exportDiagramNow(PSystemError.java:244)

at net.sourceforge.plantuml.AbstractPSystem.exportDiagram(AbstractPSystem.java:198)

at net.sourceforge.plantuml.SourceStringReader.outputImage(SourceStringReader.java:165)

at com.mb.docs.diagrams.DiagramRenderer.renderDiagram(DiagramRenderer.java:39)

at com.mb.docs.diagrams.DiagramRenderer.tryRenderDiagram(DiagramRenderer.java:26)

at java.base/java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:197)

at java.base/java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:197)

at java.base/java.util.AbstractList$RandomAccessSpliterator.forEachRemaining(AbstractList.java:720)

at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:509)

at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:499)

at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:575)

at java.base/java.util.stream.AbstractPipeline.evaluateToArrayNode(AbstractPipeline.java:260)

at java.base/java.util.stream.ReferencePipeline.toArray(ReferencePipeline.java:616)

at java.base/java.util.stream.ReferencePipeline.toArray(ReferencePipeline.java:622)

at java.base/java.util.stream.ReferencePipeline.toList(ReferencePipeline.java:627)

at com.mb.docs.PrepareDocsCommand.renderDiagrams(PrepareDocsCommand.java:126)

at com.mb.docs.PrepareDocsCommand.renderPumlDiagrams(PrepareDocsCommand.java:119)

at com.mb.docs.PrepareDocsCommand.generateMkDocsSrcFiles(PrepareDocsCommand.java:91)

at com.mb.docs.PrepareDocsCommand.run(PrepareDocsCommand.java:70)

at com.mb.docs.PrepareDocsCommand.run(PrepareDocsCommand.java:25)

at io.dropwizard.cli.ConfiguredCommand.run(ConfiguredCommand.java:98)

at io.dropwizard.cli.Cli.run(Cli.java:78)

at io.dropwizard.Application.run(Application.java:94)

at com.mb.docs.DocsBuilderApplication.main(DocsBuilderApplication.java:15)

Caused by: java.lang.ExceptionInInitializerError: Exception java.lang.InternalError: java.lang.reflect.InvocationTargetException [in thread "main"]
commented Aug 11, 2023 by The-Lu (67,080 points)
Hi,

Have you a minimal source example that produces this error?

Regards,
Th.

1 Answer

+1 vote
answered Aug 11, 2023 by anonymous

I solved it already.
The issue was that I was using  amazoncorretto:17-alpine3.18 Docker image.
Switched to ubuntu:20.04 and it's fine, I guess some fonts were missing on the former.
Thank you

...