{"record":{"id":"77b64450686431fe","repo":"flowable/flowable-engine","slug":"to-use-the-case-service-task-a-caseinstanceservice","errorCode":null,"errorMessage":"To use the case service task a CaseInstanceService implementation needs to be available in the process engine configuration","messagePattern":"To use the case service task a CaseInstanceService implementation needs to be available in the process engine configuration","errorType":"exception","errorClass":"FlowableException","httpStatus":null,"severity":"error","filePath":"modules/flowable-engine/src/main/java/org/flowable/engine/impl/bpmn/behavior/CaseTaskActivityBehavior.java","lineNumber":69,"sourceCode":"    private static final Logger LOGGER = LoggerFactory.getLogger(CaseTaskActivityBehavior.class);\n\n    private static final long serialVersionUID = 1L;\n\n    @Override\n    public void execute(DelegateExecution execution) {\n\n        ExecutionEntity executionEntity = (ExecutionEntity) execution;\n        CaseServiceTask caseServiceTask = (CaseServiceTask) executionEntity.getCurrentFlowElement();\n\n        CommandContext commandContext = CommandContextUtil.getCommandContext();\n\n        ProcessEngineConfigurationImpl processEngineConfiguration = CommandContextUtil.getProcessEngineConfiguration(commandContext);\n        ExecutionEntityManager executionEntityManager = CommandContextUtil.getExecutionEntityManager(commandContext);\n        ExpressionManager expressionManager = processEngineConfiguration.getExpressionManager();\n        CaseInstanceService caseInstanceService = processEngineConfiguration.getCaseInstanceService();\n        \n        if (caseInstanceService == null) {\n            throw new FlowableException(\"To use the case service task a CaseInstanceService implementation needs to be available in the process engine configuration\");\n        }\n\n        String businessKey = null;\n        if (!StringUtils.isEmpty(caseServiceTask.getBusinessKey())) {\n            Expression expression = expressionManager.createExpression(caseServiceTask.getBusinessKey());\n            businessKey = expression.getValue(execution).toString();\n\n        } else if (caseServiceTask.isInheritBusinessKey()) {\n            ExecutionEntity processInstance = executionEntityManager.findById(execution.getProcessInstanceId());\n            businessKey = processInstance.getBusinessKey();\n        }\n        \n        String caseInstanceName = null;\n        if (StringUtils.isNotEmpty(caseServiceTask.getCaseInstanceName())) {\n            Expression caseInstanceNameExpression = expressionManager.createExpression(caseServiceTask.getCaseInstanceName());\n            caseInstanceName = caseInstanceNameExpression.getValue(execution).toString();\n        }\n        ","sourceCodeStart":51,"sourceCodeEnd":87,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-engine/src/main/java/org/flowable/engine/impl/bpmn/behavior/CaseTaskActivityBehavior.java#L51-L87","documentation":"The CMMN case service task (CaseTaskActivityBehavior) starts a case instance through the CaseInstanceService obtained from the process engine configuration. If no CaseInstanceService implementation is registered (typically because the flowable-cmmn engine/converter isn't wired into the process engine configuration), the behavior cannot proceed and throws this FlowableException.","triggerScenarios":"A process containing a case service task (flowable:type=\"case\") executes while processEngineConfiguration.getCaseInstanceService() returns null — i.e. the engine was built without CMMN integration.","commonSituations":"Using ProcessEngineConfiguration standalone without flowable-cmmn-engine on the classpath; custom engine configuration that doesn't install the CMMN CaseInstanceService (e.g. missing cmmnEngineConfiguration/engines wiring); case task introduced into a BPMN-only deployment.","solutions":["Add the flowable-cmmn-engine dependency and run via CmmnEngineConfiguration (or app engine) so the CaseInstanceService is registered automatically.","Explicitly set an implementation: processEngineConfiguration.setCaseInstanceService(new DefaultCaseInstanceService(...)) if wiring engines manually.","If cases are not intended, replace the case service task in the BPMN with a call activity or service task.","Verify engine initialization order so the process engine is built after the CMMN engine registers its service."],"exampleFix":"// before: plain process engine without cmmn\nProcessEngineConfiguration.createStandaloneProcessEngineConfiguration()...\n// after: use the combined configuration so CaseInstanceService is available\nCmmnEngineConfiguration.createStandaloneCmmnEngineConfiguration()... // or add flowable-cmmn-engine dependency","handlingStrategy":"validation","validationCode":"if (processEngineConfiguration.getCaseInstanceService() == null) {\n    throw new IllegalStateException(\"Case service task used but CaseInstanceService not configured — add flowable-cmmn-engine\");\n}","typeGuard":null,"tryCatchPattern":"try { runtimeService.startProcessInstanceByKey(\"procWithCaseTask\"); }\ncatch (FlowableException e) { if (e.getMessage().contains(\"CaseInstanceService\")) { enableCmmnIntegration(); } else { throw e; } }","preventionTips":["Add flowable-cmmn-engine dependency when processes use case tasks.","Bootstrap via CmmnEngineConfiguration/AppEngine so services register automatically.","Smoke-test every process type at startup in a canary environment.","Scan BPMN for flowable:type=\"case\" and assert CMMN integration in CI."],"tags":["flowable","case-task","cmmn","missing-dependency","configuration"],"backgroundTag":"missing-dependency","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"}