{"record":{"id":"6b49bb356b70d2f7","repo":"flowable/flowable-engine","slug":"resource-resource-not-found-6b49bb","errorCode":null,"errorMessage":"resource '${resource}' not found","messagePattern":"resource '(.+?)' not found","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":77,"sourceCode":"            throw new FlowableException(\"could not get byte array from resource '\" + resourceName + \"'\", e);\n        }\n\n        if (bytes == null) {\n            throw new FlowableException(\"byte array for resource '\" + resourceName + \"' is null\");\n        }\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);","sourceCodeStart":59,"sourceCodeEnd":95,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/repository/CmmnDeploymentBuilderImpl.java#L59-L95","documentation":"FlowableException thrown by CmmnDeploymentBuilderImpl.addClasspathResource when the class loader cannot locate the given resource on the classpath. getResourceAsStream returns null for a missing resource, and the builder converts that into an explicit error before building the CMMN deployment. It means the deployment resource path/name does not match any classpath entry.","triggerScenarios":"Calling cmmnRepositoryService.createDeployment().addClasspathResource(\"some/path.xml\") where the path does not exist under src/main/resources (or test resources), the file name is misspelled, or the resource is not packaged into the jar/war.","commonSituations":"Wrong relative path (leading slash confusion, wrong package directory), resource excluded by Maven/Gradle resource filtering or packaging config, deploying from a shaded/fat jar where resources were not included, renaming the .cmmn/.cmmn10/.xml file without updating code.","solutions":["Verify the resource exists exactly at the given path under src/main/resources and fix the path string","Check the file was compiled/packaged into target/classes (or the jar); run a clean build","Try ClassLoader lookup in isolation to confirm resolution before calling addClasspathResource","If loading from the filesystem instead, use addInputStream(new FileInputStream(...)) rather than a classpath path"],"exampleFix":"// before\nrepositoryService.createDeployment().addClasspathResource(\"diagrams/order-process.xml\");\n// after\nrepositoryService.createDeployment().addClasspathResource(\"processes/order-process.cmmn.xml\"); // path matches src/main/resources/processes/order-process.cmmn.xml","handlingStrategy":"validation","validationCode":"boolean exists = Thread.currentThread().getContextClassLoader().getResource(resource) != null || CmmnDeploymentBuilderImpl.class.getClassLoader().getResource(resource) != null;\nif (!exists) throw new IllegalArgumentException(\"Classpath resource missing: \" + resource);","typeGuard":"static boolean classpathResourceExists(String resource) {\n    ClassLoader cl = Thread.currentThread().getContextClassLoader();\n    return resource != null && (cl.getResource(resource) != null || CmmnDeploymentBuilderImpl.class.getClassLoader().getResource(resource) != null);\n}","tryCatchPattern":"try {\n    builder.addClasspathResource(resource);\n} catch (FlowableException e) {\n    if (e.getMessage() != null && e.getMessage().contains(\"not found\")) {\n        throw new ConfigurationException(\"CMMN resource not on classpath: \" + resource, e);\n    }\n    throw e;\n}","preventionTips":["Keep a single constant/enum of resource paths used in deployments","Add a startup test that deploys all declared resources to catch path drift","Verify resources land in target/classes after build (mvn clean package; jar tf)","Avoid mixing leading-slash and package-relative resource conventions"],"tags":["classpath","resource-not-found","deployment","cmmn"],"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"}