{"record":{"id":"61de121e7f6e8427","repo":"flowable/flowable-engine","slug":"resource-resource-doesn-t-exist-61de12","errorCode":null,"errorMessage":"resource '${resource}' doesn't exist","messagePattern":"resource '(.+?)' doesn't exist","errorType":"exception","errorClass":"FlowableException","httpStatus":null,"severity":"error","filePath":"modules/flowable-idm-engine/src/main/java/org/flowable/idm/engine/impl/io/ResourceStreamSource.java","lineNumber":36,"sourceCode":"import org.flowable.common.engine.api.FlowableException;\nimport org.flowable.common.engine.impl.util.io.StreamSource;\n\n/**\n * @author Joram Barrez\n */\npublic class ResourceStreamSource implements StreamSource {\n\n    String resource;\n\n    public ResourceStreamSource(String resource) {\n        this.resource = resource;\n    }\n\n    @Override\n    public InputStream getInputStream() {\n        InputStream inputStream = this.getClass().getClassLoader().getResourceAsStream(resource);\n        if (inputStream == null) {\n            throw new FlowableException(\"resource '\" + resource + \"' doesn't exist\");\n        }\n        return new BufferedInputStream(inputStream);\n    }\n\n    @Override\n    public String toString() {\n        return \"Resource[\" + resource + \"]\";\n    }\n}\n","sourceCodeStart":18,"sourceCodeEnd":46,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-idm-engine/src/main/java/org/flowable/idm/engine/impl/io/ResourceStreamSource.java#L18-L46","documentation":"ResourceStreamSource loads a classpath resource and throws this if getResourceAsStream returns null, i.e. the named resource is not on the classpath. It is used by the IDM engine when reading resources (e.g. configuration or schema files) by path.","triggerScenarios":"Calling getInputStream() on a ResourceStreamSource constructed with a resource string that does not exist in any classpath entry, including typos or a wrong leading-slash convention.","commonSituations":"Typo in the resource path; resource not packaged into the jar/war (missing from src/main/resources); resource lives in a different module not on the classpath.","solutions":["Verify the exact resource path exists under src/main/resources and matches case-sensitively.","Check the built artifact (jar/war) actually contains the resource.","Use an absolute-from-classpath path form (leading '/' refers to classpath root; no './' prefixes).","If loading from the filesystem instead, use a file-based StreamSource or a URL source."],"exampleFix":"// before — file missing from classpath\nnew ResourceStreamSource(\"org/flowable/idm/db/create/flowable.idm.create.sql\")\n// after — ensure the file exists under src/main/resources at this exact path\nnew ResourceStreamSource(\"/org/flowable/idm/db/create/flowable.idm.create.sql\")","handlingStrategy":"validation","validationCode":"String path = \"/org/flowable/idm/db/create/flowable.idm.create.sql\";\nif (getClass().getClassLoader().getResource(path) == null) {\n  throw new IllegalStateException(\"Resource not on classpath: \" + path);\n}","typeGuard":null,"tryCatchPattern":"try {\n  InputStream in = streamSource.getInputStream();\n} catch (FlowableException e) {\n  if (e.getMessage().contains(\"doesn't exist\")) {\n    // fall back to another source or fail with a clear message\n  }\n  throw e;\n}","preventionTips":["Verify resources are under src/main/resources so they land in the jar.","Match resource paths case-sensitively (classpaths are case-sensitive in jars).","Check packaged jar contents (jar tf app.jar) in CI.","Prefer programmatic sources or explicit file paths for generated content."],"tags":["classpath","resource","io"],"backgroundTag":"file-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"}