{"record":{"id":"1b31a74aab7f0302","repo":"flowable/flowable-engine","slug":"resource-not-found","errorCode":null,"errorMessage":"resource '' not found","messagePattern":"resource '' not found","errorType":"exception","errorClass":"FlowableIllegalArgumentException","httpStatus":null,"severity":"error","filePath":"modules/flowable-engine/src/main/java/org/flowable/engine/impl/repository/DeploymentBuilderImpl.java","lineNumber":80,"sourceCode":"\n    @Override\n    public DeploymentBuilder addInputStream(String resourceName, InputStream inputStream) {\n        if (inputStream == null) {\n            throw new FlowableIllegalArgumentException(\"inputStream for resource '\" + resourceName + \"' is null\");\n        }\n        byte[] bytes = IoUtil.readInputStream(inputStream, resourceName);\n        ResourceEntity resource = resourceEntityManager.create();\n        resource.setName(resourceName);\n        resource.setBytes(bytes);\n        deployment.addResource(resource);\n        return this;\n    }\n\n    @Override\n    public DeploymentBuilder addClasspathResource(String resource) {\n        try (final InputStream inputStream = ReflectUtil.getResourceAsStream(resource)) {\n\t        if (inputStream == null) {\n\t            throw new FlowableIllegalArgumentException(\"resource '\" + resource + \"' not found\");\n\t        }\n\t        return addInputStream(resource, inputStream);\n\t        \n        } catch (IOException ex) {\n            throw new FlowableException(\"Failed to read resource \" + resource, ex);\n        }\n\n    }\n\n    @Override\n    public DeploymentBuilder addString(String resourceName, String text) {\n        if (text == null) {\n            throw new FlowableIllegalArgumentException(\"text is null\");\n        }\n        ResourceEntity resource = resourceEntityManager.create();\n        resource.setName(resourceName);\n        resource.setBytes(text.getBytes(StandardCharsets.UTF_8));\n        deployment.addResource(resource);","sourceCodeStart":62,"sourceCodeEnd":98,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-engine/src/main/java/org/flowable/engine/impl/repository/DeploymentBuilderImpl.java#L62-L98","documentation":"DeploymentBuilderImpl.addClasspathResource loads the resource from the classpath via ReflectUtil.getResourceAsStream; if no classpath entry matches, the stream is null and a FlowableIllegalArgumentException \"resource 'X' not found\" is thrown. The named resource must exist on the engine's classpath to become a deployment resource.","triggerScenarios":"repositoryService.createDeployment().addClasspathResource(\"path/file.bpmn20.xml\") where the path is misspelled, missing a leading folder, or the file is not packaged on the classpath (not in src/main/resources or the deployed artifact).","commonSituations":"Leading-slash vs relative path confusion (classpath resources usually need no leading slash here); file placed under a directory not marked as resources root; resource not included in the built JAR/WAR; renamed or moved BPMN files after refactoring; running tests where test resources differ from main resources.","solutions":["Verify the exact path relative to the classpath root and confirm the file is in src/main/resources (or test resources) and included in the build output.","Print the resolved URL: getClass().getClassLoader().getResource(resource) — if null, fix the path/packaging before deploying.","Remove a leading '/' if present (ClassLoader.getResourceAsStream treats paths as root-relative already).","If loading from disk instead, use addInputStream or a FileInputStream-based variant with an existing-file check."],"exampleFix":"// before\nrepositoryService.createDeployment().addClasspathResource(\"/processes/order.bpmn20.xml\").deploy(); // not found\n// after\nString res = \"processes/order.bpmn20.xml\";\nif (getClass().getClassLoader().getResource(res) == null) throw new IllegalStateException(\"Not on classpath: \" + res);\nrepositoryService.createDeployment().addClasspathResource(res).deploy();","handlingStrategy":"validation","validationCode":"java.net.URL url = getClass().getClassLoader().getResource(resource);\nif (url == null) throw new IllegalStateException(\"Classpath resource not found: \" + resource);","typeGuard":null,"tryCatchPattern":"try { builder.addClasspathResource(resource); } catch (FlowableIllegalArgumentException e) { if (e.getMessage().contains(\"not found\")) { /* correct path/packaging */ } else throw e; }","preventionTips":["Place BPMN/XML under src/main/resources and verify inclusion in the build artifact","Use classpath-root-relative paths without a leading slash","Sanity-check getResource(resource) != null in tests before deploying","Re-check resource names after refactors/renames"],"tags":["deployment","classpath","resource-not-found"],"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-14T05:17:10.506Z"}