{"record":{"id":"30572037c28889d6","repo":"flowable/flowable-engine","slug":"couldn-t-execute-event-listener-305720","errorCode":null,"errorMessage":"couldn't execute event listener : ","messagePattern":"couldn't execute event listener : ","errorType":"exception","errorClass":"PvmException","httpStatus":null,"severity":"error","filePath":"modules/flowable5-engine/src/main/java/org/activiti/engine/impl/pvm/runtime/AtomicOperationTransitionNotifyListenerTake.java","lineNumber":57,"sourceCode":"    }\n\n    @Override\n    public void execute(InterpretableExecution execution) {\n        TransitionImpl transition = execution.getTransition();\n\n        List<ExecutionListener> executionListeners = transition.getExecutionListeners();\n        int executionListenerIndex = execution.getExecutionListenerIndex();\n\n        if (executionListeners.size() > executionListenerIndex) {\n            execution.setEventName(org.activiti.engine.impl.pvm.PvmEvent.EVENTNAME_TAKE);\n            execution.setEventSource(transition);\n            ExecutionListener listener = executionListeners.get(executionListenerIndex);\n            try {\n                listener.notify(execution);\n            } catch (RuntimeException e) {\n                throw e;\n            } catch (Exception e) {\n                throw new PvmException(\"couldn't execute event listener : \" + e.getMessage(), e);\n            }\n            execution.setExecutionListenerIndex(executionListenerIndex + 1);\n            execution.performOperation(this);\n\n        } else {\n            if (LOGGER.isDebugEnabled()) {\n                LOGGER.debug(\"{} takes transition {}\", execution, transition);\n            }\n            execution.setExecutionListenerIndex(0);\n            execution.setEventName(null);\n            execution.setEventSource(null);\n\n            ActivityImpl activity = (ActivityImpl) execution.getActivity();\n            ActivityImpl nextScope = findNextScope(activity.getParent(), transition.getDestination());\n            execution.setActivity(nextScope);\n\n            // Firing event that transition is being taken\n            if (Context.getProcessEngineConfiguration() != null && Context.getProcessEngineConfiguration().getEventDispatcher().isEnabled()) {","sourceCodeStart":39,"sourceCodeEnd":75,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable5-engine/src/main/java/org/activiti/engine/impl/pvm/runtime/AtomicOperationTransitionNotifyListenerTake.java#L39-L75","documentation":"Thrown when an ExecutionListener.notify(execution) registered on a transition 'take' event throws a checked Exception. The PVM rethrows it as a PvmException preserving the cause. Runtime exceptions from listeners are propagated unchanged; only non-Runtime exceptions are wrapped.","triggerScenarios":"An ExecutionListener configured on a sequence flow's take event implements notify() with checked exceptions (e.g. I/O, reflection, custom checked types) that are not caught inside the listener.","commonSituations":"Listeners doing JMS/HTTP notifications or file access; custom listeners written for older Java where checked exceptions were declared; misconfigured listener classes failing to load/invoke via reflection.","solutions":["Inspect the cause of the PvmException to find the listener's checked exception","Fix or catch the checked exception inside the listener's notify() method","Wrap checked exceptions in a RuntimeException (e.g. ActivitiException) within the listener","Verify the listener class is on the classpath and its notify() handles failure conditions"],"exampleFix":"// before\npublic void notify(DelegateExecution exec) throws Exception {\n  Files.write(path, bytes); // throws IOException\n}\n// after\npublic void notify(DelegateExecution exec) {\n  try { Files.write(path, bytes); }\n  catch (IOException e) { throw new ActivitiException(\"listener write failed\", e); }\n}","handlingStrategy":"try-catch","validationCode":"// ensure listener class resolves before deployment\nClass.forName(listenerClassName);","typeGuard":null,"tryCatchPattern":"try {\n  taskService.complete(taskId);\n} catch (PvmException e) {\n  log.error(\"execution listener failed on take\", e.getCause());\n}","preventionTips":["Catch checked exceptions inside every ExecutionListener.notify()","Keep listeners side-effect-light or make failures explicit runtime errors","Register listeners with correct event types (take/end/start)"],"tags":["process-engine","execution-listener","wrapped-exception"],"backgroundTag":"upstream-api-error","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"}