{"record":{"id":"2126325d1d05177a","repo":"flowable/flowable-engine","slug":"could-not-load-image-for-process-diagram-creation","errorCode":null,"errorMessage":"Could not load image for process diagram creation: {}","messagePattern":"Could not load image for process diagram creation: (.+?)","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"modules/flowable-image-generator/src/main/java/org/flowable/image/impl/DefaultProcessDiagramCanvas.java","lineNumber":252,"sourceCode":"            DMN_TASK_IMAGE = ImageIO.read(ReflectUtil.getResource(\"org/flowable/icons/dmnTask.png\", customClassLoader));\n            CAMEL_TASK_IMAGE = ImageIO.read(ReflectUtil.getResource(\"org/flowable/icons/camelTask.png\", customClassLoader));\n            HTTP_TASK_IMAGE = ImageIO.read(ReflectUtil.getResource(\"org/flowable/icons/httpTask.png\", customClassLoader));\n\n            TIMER_IMAGE = ImageIO.read(ReflectUtil.getResource(\"org/flowable/icons/timer.png\", customClassLoader));\n            COMPENSATE_THROW_IMAGE = ImageIO.read(ReflectUtil.getResource(\"org/flowable/icons/compensate-throw.png\", customClassLoader));\n            COMPENSATE_CATCH_IMAGE = ImageIO.read(ReflectUtil.getResource(\"org/flowable/icons/compensate.png\", customClassLoader));\n            CONDITIONAL_CATCH_IMAGE = ImageIO.read(ReflectUtil.getResource(\"org/flowable/icons/conditional.png\", customClassLoader));\n            ERROR_THROW_IMAGE = ImageIO.read(ReflectUtil.getResource(\"org/flowable/icons/error-throw.png\", customClassLoader));\n            ERROR_CATCH_IMAGE = ImageIO.read(ReflectUtil.getResource(\"org/flowable/icons/error.png\", customClassLoader));\n            ESCALATION_THROW_IMAGE = ImageIO.read(ReflectUtil.getResource(\"org/flowable/icons/escalation-throw.png\", customClassLoader));\n            ESCALATION_CATCH_IMAGE = ImageIO.read(ReflectUtil.getResource(\"org/flowable/icons/escalation.png\", customClassLoader));\n            MESSAGE_THROW_IMAGE = ImageIO.read(ReflectUtil.getResource(\"org/flowable/icons/message-throw.png\", customClassLoader));\n            MESSAGE_CATCH_IMAGE = ImageIO.read(ReflectUtil.getResource(\"org/flowable/icons/message.png\", customClassLoader));\n            SIGNAL_THROW_IMAGE = ImageIO.read(ReflectUtil.getResource(\"org/flowable/icons/signal-throw.png\", customClassLoader));\n            SIGNAL_CATCH_IMAGE = ImageIO.read(ReflectUtil.getResource(\"org/flowable/icons/signal.png\", customClassLoader));\n            \n        } catch (IOException e) {\n            LOGGER.warn(\"Could not load image for process diagram creation: {}\", e.getMessage());\n        }\n    }\n\n    /**\n     * Generates an image of what currently is drawn on the canvas.\n     * \n     * Throws an {@link FlowableImageException} when {@link #close()} is already called.\n     */\n    public InputStream generateImage(String imageType) {\n        if (closed) {\n            throw new FlowableImageException(\"ProcessDiagramGenerator already closed\");\n        }\n\n        try (ByteArrayOutputStream out = new ByteArrayOutputStream()) {\n            ImageIO.write(processDiagram, imageType, out);\n            return new ByteArrayInputStream(out.toByteArray());\n        } catch (IOException e) {\n            throw new FlowableImageException(\"Error while generating process image\", e);","sourceCodeStart":234,"sourceCodeEnd":270,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-image-generator/src/main/java/org/flowable/image/impl/DefaultProcessDiagramCanvas.java#L234-L270","documentation":"WARN logged by DefaultProcessDiagramCanvas.initialize when reading the bundled Flowable icon PNGs (message/signal throw/catch) fails with an IOException. The canvas continues with null image fields, so generated process diagrams will be missing those icon graphics. Usually indicates the classpath resources were not packaged or the custom classloader cannot see them.","triggerScenarios":"Constructor -> initialize calls ImageIO.read(ReflectUtil.getResource(...)) for each icon; IOException occurs when resource bytes are unreadable/missing or the provided customClassLoader cannot locate org/flowable/icons/*.png.","commonSituations":"See trigger scenarios.","solutions":["Ensure flowable-image-generator jar (and its org/flowable/icons resources) is on the runtime classpath","Check build config that resource filtering/exclusion is not stripping *.png files (e.g. maven resource filtering of binaries)","Pass the correct customClassLoader or null to use the default classloader","Ignore the warning if icons are not needed — diagrams still generate without them"],"exampleFix":"<!-- before: maven filtering corrupts binaries -->\n<resource><directory>src/main/resources</directory><filtering>true</filtering></resource>\n<!-- after -->\n<resource><directory>src/main/resources</directory><filtering>false</filtering><excludes><exclude>**/*.png</exclude></excludes></resource>","handlingStrategy":"fallback","validationCode":"// verify icons are resolvable before generating diagrams\ntry (InputStream is = getClass().getClassLoader()\n        .getResourceAsStream(\"org/flowable/icons/signal.png\")) {\n    if (is == null) throw new IllegalStateException(\"Flowable icon resources missing from classpath\");\n}","typeGuard":null,"tryCatchPattern":"try {\n    ProcessDiagramGenerator gen = new DefaultProcessDiagramGenerator();\n    diagram = gen.generateDiagram(model, \"png\", activeActivityIds);\n} catch (FlowableException e) {\n    LOGGER.warn(\"Diagram generation degraded: {}\", e.getMessage());\n    diagram = null; // proceed without diagram\n}","preventionTips":["Keep flowable-image-generator jar intact (do not strip resources in fat jars)","Disable binary resource filtering in build configs","Treat diagram generation as optional and degrade gracefully","Test diagram generation in the same classloading environment as production (app servers/OSGi)"],"tags":["classpath","image-io","diagram-generation"],"backgroundTag":"resource-not-found","analyzedSha":"d6d39ce1c69ff244f2d9dc6af756a9b95e865586","analyzedAt":"2026-09-11T06:41:19.413Z","contentChangedAt":"2026-09-11T06:41:19.413Z","schemaVersion":2},"datasetVersion":"2026-09-18T11:17:12.947Z"}