{"record":{"id":"7261bd1b12f6353b","repo":"flowable/flowable-engine","slug":"failed-to-read-resource-resource-7261bd","errorCode":null,"errorMessage":"Failed to read resource ${resource}","messagePattern":"Failed to read resource (.+?)","errorType":"exception","errorClass":"FlowableException","httpStatus":null,"severity":"error","filePath":"modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/repository/CmmnDeploymentBuilderImpl.java","lineNumber":82,"sourceCode":"        }\n\n        CmmnResourceEntity resource = resourceEntityManager.create();\n        resource.setName(resourceName);\n        resource.setBytes(bytes);\n        deployment.addResource(resource);\n        return this;\n    }\n\n    @Override\n    public CmmnDeploymentBuilder addClasspathResource(String resource) {\n        try (final InputStream inputStream = this.getClass().getClassLoader().getResourceAsStream(resource)) {\n            if (inputStream == null) {\n                throw new FlowableException(\"resource '\" + resource + \"' not found\");\n            }\n            return addInputStream(resource, inputStream);\n            \n        } catch (IOException ex) {\n            throw new FlowableException(\"Failed to read resource \" + resource, ex);\n        }\n    }\n\n    @Override\n    public CmmnDeploymentBuilder addString(String resourceName, String text) {\n        if (text == null) {\n            throw new FlowableException(\"text is null\");\n        }\n\n        CmmnResourceEntity resource = resourceEntityManager.create();\n        resource.setName(resourceName);\n        resource.setBytes(text.getBytes(StandardCharsets.UTF_8));\n        deployment.addResource(resource);\n        return this;\n    }\n    \n    @Override\n    public CmmnDeploymentBuilder addBytes(String resourceName, byte[] bytes) {","sourceCodeStart":64,"sourceCodeEnd":100,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/repository/CmmnDeploymentBuilderImpl.java#L64-L100","documentation":"FlowableException thrown when an IOException occurs while the classpath resource stream is being opened or read inside addClasspathResource. Unlike the 'not found' case, the resource was locatable but reading its bytes failed. The original IOException is attached as the cause.","triggerScenarios":"Calling addClasspathResource(resource) where the underlying resource stream cannot be read — e.g. IO errors opening a jar-backed resource, a corrupted jar on the classpath, or a broken custom ClassLoader implementation.","commonSituations":"Corrupted or concurrently replaced jar/war in the app server, custom classloader that throws on getResourceAsStream, filesystem/disk errors in containerized environments.","solutions":["Inspect the wrapped IOException cause for the underlying read failure","Rebuild/redeploy the artifact — the jar containing the resource may be corrupted","Verify classloader behavior if using a custom or framework-provided classloader","Retry after fixing environment issues (disk full, file locks)"],"exampleFix":"try {\n    repositoryService.createDeployment().addClasspathResource(\"processes/order.cmmn.xml\");\n} catch (FlowableException e) {\n    logger.error(\"Resource read failed\", e.getCause()); // inspect the wrapped IOException\n}","handlingStrategy":"try-catch","validationCode":"try (InputStream is = getClass().getClassLoader().getResourceAsStream(resource)) {\n    if (is != null) { is.readAllBytes(); } // force read to surface IO problems early\n}","typeGuard":null,"tryCatchPattern":"try {\n    builder.addClasspathResource(resource);\n} catch (FlowableException e) {\n    Throwable cause = e.getCause();\n    if (cause instanceof IOException) {\n        logger.error(\"Failed reading CMMN resource {}: {}\", resource, cause.getMessage());\n    }\n    throw e;\n}","preventionTips":["Validate jar integrity of artifacts containing the resources before deployment","Avoid replacing jars under a running application","Prefer reading the resource fully in your own code first, then use addBytes","Log the wrapped cause — the message alone does not identify the IO problem"],"tags":["io","classpath","resource-read","cmmn"],"backgroundTag":"file-read-failed","analyzedSha":"d6d39ce1c69ff244f2d9dc6af756a9b95e865586","analyzedAt":"2026-09-11T06:41:19.413Z","contentChangedAt":"2026-09-11T06:41:19.413Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}