{"record":{"id":"70b87898e727b779","repo":"flowable/flowable-engine","slug":"delegateinstance-getclass-getname-does","errorCode":null,"errorMessage":"\" + delegateInstance.getClass().getName() + \" doesn't implement \" + HttpRequestHandler.class","messagePattern":"\" \\+ delegateInstance\\.getClass\\(\\)\\.getName\\(\\) \\+ \" doesn't implement \" \\+ HttpRequestHandler\\.class","errorType":"exception","errorClass":"FlowableIllegalArgumentException","httpStatus":null,"severity":"error","filePath":"modules/flowable-engine/src/main/java/org/flowable/engine/impl/bpmn/http/handler/ClassDelegateHttpHandler.java","lineNumber":67,"sourceCode":"\n    @Override\n    public void handleHttpRequest(VariableContainer execution, HttpRequest httpRequest, FlowableHttpClient client) {\n        HttpRequestHandler httpRequestHandler = getHttpRequestHandlerInstance();\n        CommandContextUtil.getProcessEngineConfiguration().getDelegateInterceptor().handleInvocation(new HttpRequestHandlerInvocation(httpRequestHandler, execution, httpRequest, client));\n    }\n\n    @Override\n    public void handleHttpResponse(VariableContainer execution, HttpResponse httpResponse) {\n        HttpResponseHandler httpResponseHandler = getHttpResponseHandlerInstance();\n        CommandContextUtil.getProcessEngineConfiguration().getDelegateInterceptor().handleInvocation(new HttpResponseHandlerInvocation(httpResponseHandler, execution, httpResponse));\n    }\n\n    protected HttpRequestHandler getHttpRequestHandlerInstance() {\n        Object delegateInstance = instantiateDelegate(className, fieldDeclarations);\n        if (delegateInstance instanceof HttpRequestHandler) {\n            return (HttpRequestHandler) delegateInstance;\n        } else {\n            throw new FlowableIllegalArgumentException(delegateInstance.getClass().getName() + \" doesn't implement \" + HttpRequestHandler.class);\n        }\n    }\n\n    protected HttpResponseHandler getHttpResponseHandlerInstance() {\n        Object delegateInstance = instantiateDelegate(className, fieldDeclarations);\n        if (delegateInstance instanceof HttpResponseHandler) {\n            return (HttpResponseHandler) delegateInstance;\n        } else {\n            throw new FlowableIllegalArgumentException(delegateInstance.getClass().getName() + \" doesn't implement \" + HttpResponseHandler.class);\n        }\n    }\n\n}\n","sourceCodeStart":49,"sourceCodeEnd":81,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-engine/src/main/java/org/flowable/engine/impl/bpmn/http/handler/ClassDelegateHttpHandler.java#L49-L81","documentation":"ClassDelegateHttpHandler.getHttpRequestHandlerInstance throws this FlowableIllegalArgumentException when the class configured as an HTTP request handler (via className) is instantiated but does not implement the HttpRequestHandler interface. The engine verifies the contract after instantiation and refuses to use an incompatible class.","triggerScenarios":"httpActivityHandler / HTTP task configuration specifies a delegate class whose name implements HttpResponseHandler (or nothing relevant) but not HttpRequestHandler; ClassDelegateHttpHandler is constructed with that className and lazily instantiates it when a request handler is needed.","commonSituations":"Copy-paste of a response handler class into the request-handler config slot; refactoring renamed/moved interfaces (e.g. between flowable-http and engine modules); missing 'implements HttpRequestHandler' after auto-generating a class; mixing up handlerClass and handler configuration properties in engine config.","solutions":["Make the configured class implement org.flowable.http.HttpRequestHandler (add httpRequest(...)) or change the config to a class that does.","Double-check configuration: request handler fields must reference a request handler; response handler fields a response handler — swap if inverted.","Verify the package: there are historically similar interfaces (HttpRequestHandler in different modules); import the one the engine expects.","Add a startup/unit test that instantiates the handler and asserts instanceof HttpRequestHandler to fail fast."],"exampleFix":"// before\npublic class MyHandler { public void handle(...) {...} }\n\n// after\npublic class MyHandler implements HttpRequestHandler {\n    @Override\n    public void httpRequest(ExecuteHttpRequest request) { ... }\n}","handlingStrategy":"validation","validationCode":"Class<?> c = Class.forName(configuredRequestHandlerClass);\nif (!HttpRequestHandler.class.isAssignableFrom(c)) {\n    throw new IllegalStateException(configuredRequestHandlerClass + \" must implement HttpRequestHandler\");\n}","typeGuard":"static boolean isRequestHandler(String className) throws ClassNotFoundException {\n    return HttpRequestHandler.class.isAssignableFrom(Class.forName(className));\n}","tryCatchPattern":"try {\n    handler.getHttpRequestHandlerInstance();\n} catch (FlowableIllegalArgumentException e) {\n    if (e.getMessage().contains(\"doesn't implement\")) {\n        // swap in a compliant default handler\n    }\n}","preventionTips":["Assert handler classes implement the right interface in a startup check or unit test.","Keep request and response handler classes in clearly named, separate classes.","Re-verify handler configs after Flowable version upgrades (interface moves/renames)."],"tags":["flowable","http-task","delegate","type-mismatch","class-config"],"backgroundTag":"incompatible-source-type","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"}