{"record":{"id":"39bc0382547c9cbf","repo":"flowable/flowable-engine","slug":"class-classname-does-not-implement-flowableevent","errorCode":null,"errorMessage":"Class <className> does not implement FlowableEventListener","messagePattern":"Class <className> does not implement FlowableEventListener","errorType":"exception","errorClass":"FlowableIllegalArgumentException","httpStatus":null,"severity":"error","filePath":"modules/flowable-engine/src/main/java/org/flowable/engine/impl/bpmn/helper/DelegateFlowableEventListener.java","lineNumber":64,"sourceCode":"\n    @Override\n    public boolean isFailOnException() {\n        if (delegateInstance != null) {\n            return delegateInstance.isFailOnException();\n        }\n        return failOnException;\n    }\n\n    protected FlowableEventListener getDelegateInstance() {\n        if (delegateInstance == null) {\n            Object instance = ReflectUtil.instantiate(className);\n            if (instance instanceof FlowableEventListener) {\n                delegateInstance = (FlowableEventListener) instance;\n            } else {\n                // Force failing of the listener invocation, since the delegate\n                // cannot be created\n                failOnException = true;\n                throw new FlowableIllegalArgumentException(\"Class \" + className + \" does not implement \" + FlowableEventListener.class.getName());\n            }\n        }\n        return delegateInstance;\n    }\n}\n","sourceCodeStart":46,"sourceCodeEnd":70,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-engine/src/main/java/org/flowable/engine/impl/bpmn/helper/DelegateFlowableEventListener.java#L46-L70","documentation":"Thrown by DelegateFlowableEventListener.getDelegateInstance as a FlowableIllegalArgumentException when the configured listener class name instantiates successfully but the resulting object does not implement FlowableEventListener. failOnException is set to true so the failure surfaces instead of being ignored.","triggerScenarios":"An event listener registered by class name points at a class whose newInstance/objectFactory result is not a FlowableEventListener; getDelegateInstance is called from onEvent during event dispatch.","commonSituations":"Wrong class name in listener configuration; class refactored to drop the FlowableEventListener interface; confusion between different listener interfaces (e.g. Activiti vs Flowable, or entity vs engine listeners) after a migration.","solutions":["Make the configured class implement org.flowable.engine.delegate.event.FlowableEventListener","Correct the class name in the listener registration/configuration","Check for mixed Activiti/Flowable imports causing the interface to be missing","Add a startup smoke test that instantiates configured listeners and asserts the interface"],"exampleFix":"// before\npublic class MyListener implements ActivitiEventListener { ... }\n// after\npublic class MyListener implements org.flowable.engine.delegate.event.FlowableEventListener {\n    public void onEvent(FlowableEvent event) { ... }\n    public boolean isFailOnException() { return false; }\n}","handlingStrategy":"type-guard","validationCode":"Class<?> c = Class.forName(listenerClassName, true, classLoader);\nif (!FlowableEventListener.class.isAssignableFrom(c)) {\n    throw new IllegalStateException(listenerClassName + \" must implement FlowableEventListener\");\n}","typeGuard":"static boolean isValidListenerClass(String className) {\n    try { return FlowableEventListener.class.isAssignableFrom(Class.forName(className)); }\n    catch (ClassNotFoundException e) { return false; }\n}","tryCatchPattern":"try { runtimeService.startProcessInstanceByKey(key); }\ncatch (FlowableIllegalArgumentException e) {\n    if (e.getMessage().contains(\"does not implement \" + FlowableEventListener.class.getName())) {\n        log.error(\"Configured listener class wrong type: {}\", e.getMessage());\n    } else throw e;\n}","preventionTips":["Register listener classes with fully qualified names of FlowableEventListener implementations","Validate configured listener classes in a startup integration test","Check imports carefully when migrating from Activiti to Flowable"],"tags":["java","event-listener","class-name","wrong-type"],"backgroundTag":"invalid-argument-value","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"}