Could not initialize class net.sourceforge.plantuml.ugraphic.UFont

0 votes
asked Jun 18 in Question / help by anonymous
edited Jun 18

Hi,

When we tried to use the plantuml lib to generate call flow diagrams, we've got the following exception.

java.lang.NoClassDefFoundError: Could not initialize class net.sourceforge.plantuml.ugraphic.UFont
at net.sourceforge.plantuml.graphic.GraphicStrings.sansSerif12(GraphicStrings.java:119)
at net.sourceforge.plantuml.graphic.GraphicStrings.createBlackOnWhite(GraphicStrings.java:114)
at net.sourceforge.plantuml.UmlDiagram.exportDiagramError(UmlDiagram.java:246)
at net.sourceforge.plantuml.UmlDiagram.exportDiagramError(UmlDiagram.java:219)
at net.sourceforge.plantuml.UmlDiagram.exportDiagramNow(UmlDiagram.java:212)
at net.sourceforge.plantuml.AbstractPSystem.exportDiagram(AbstractPSystem.java:140)
at net.sourceforge.plantuml.SourceStringReader.outputImage(SourceStringReader.java:156)
at net.sourceforge.plantuml.SourceStringReader.outputImage(SourceStringReader.java:128)

Our environment is: plantuml 1.2020.12, tomcat 7.0.94,  and openJDK 1.8.0_252-b09 in virtual linux.

Any solution to solve this issue? Thanks.

Hong

commented Jun 19 by Serge Wenger Work (12,800 points)
Please provide a small example to help reproduce
commented Jun 24 by anonymous
something like:

String text = "@startuml\n" +

"Alice -> Bob: Authentication Request\n" +

"Bob --> Alice: Authentication Response\n" +

"@enduml";

    private URI generateCallflowDiagram(String text, String outputFile) {

        try {

            logger.info("generateCallflowDiagram: " + text + " outputFile=: " + outputFile);

            SourceStringReader reader = new SourceStringReader(text);

            logger.info("sourcestringreader made");

            final ByteArrayOutputStream os = new ByteArrayOutputStream();

            logger.info("bytearrayoutputstream created");

            String desc = reader.outputImage(os, new FileFormatOption(FileFormat.SVG)).getDescription();

            logger.info("image generated");

            os.close();

....

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.
Anti-spam verification:

[Antispam2 Feature: please please wait 1 or 2 minutes (this message will disappear) before pressing the button otherwise it will fail](--------)
To avoid this verification in future, please log in or register.
...