{"record":{"id":"c1956e8e21d0d45f","repo":"quarkusio/quarkus","slug":"cannot-find-method-methodname-parametertypes","errorCode":null,"errorMessage":"Cannot find method ${methodName}${parameterTypes} on ${clazz}","messagePattern":"Cannot find method (.+?)(.+?) on (.+?)","errorType":"exception","errorClass":"java.lang.IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"independent-projects/arc/runtime/src/main/java/io/quarkus/arc/impl/Reflections.java","lineNumber":115,"sourceCode":"                theClass = theClass.getSuperclass();\n            }\n        }\n        //look for default methods on interfaces\n        Set<Class<?>> seen = new HashSet<>(interfaces);\n        while (!interfaces.isEmpty()) {\n            Class<?> iface = interfaces.pop();\n            try {\n                return iface.getDeclaredMethod(methodName, parameterTypes);\n            } catch (NoSuchMethodException ex) {\n                //ignore\n            }\n            for (Class<?> extra : iface.getInterfaces()) {\n                if (seen.add(extra)) {\n                    interfaces.add(extra);\n                }\n            }\n        }\n        throw new IllegalArgumentException(\"Cannot find method \" + methodName + Arrays.asList(parameterTypes) + \" on \" + clazz);\n    }\n\n    public static Constructor<?> findConstructor(Class<?> clazz, Class<?>... parameterTypes) {\n        try {\n            return clazz.getDeclaredConstructor(parameterTypes);\n        } catch (NoSuchMethodException e) {\n            throw new IllegalArgumentException(e);\n        }\n    }\n\n    public static Object newInstance(Class<?> clazz, Class<?>[] parameterTypes, Object[] args) {\n        Constructor<?> constructor = findConstructor(clazz, parameterTypes);\n        if (constructor != null) {\n            if (!constructor.canAccess(null)) {\n                constructor.setAccessible(true);\n            }\n            try {\n                return constructor.newInstance(args);","sourceCodeStart":97,"sourceCodeEnd":133,"githubUrl":"https://github.com/quarkusio/quarkus/blob/e1c734241f34c7919086ceb4c9262b4a58f6de44/independent-projects/arc/runtime/src/main/java/io/quarkus/arc/impl/Reflections.java#L97-L133","documentation":"Reflections.findMethod() walks the class and its interface hierarchy looking for a declared method with the given name and parameter types; if none is found it throws IllegalArgumentException with this message. It is used during reflective bean/interceptor setup, so it means declared reflective metadata doesn't match any real method.","triggerScenarios":"Calling Reflections.findMethod(clazz, name, paramTypes...) where the method was renamed, removed, or has a different signature (added/changed parameters, primitives vs wrappers, varargs differences).","commonSituations":"Upgrading a library whose method signature changed while reflective references (generated code, config in strings) still use the old one; typos in method names; passing wrong parameter type list (boxed Integer vs int).","solutions":["Verify the exact method name and parameter types exist on the class (use javap or IDE) and correct the arguments.","Account for inheritance: findMethod searches superclasses/interfaces — if the method is private on a supertype, locate it on the declaring class directly.","After a dependency upgrade, regenerate any code or update reflective references to the new signature.","Check boxed vs primitive parameter types (Integer.class vs int.class)."],"exampleFix":"// before\nReflections.findMethod(Foo.class, \"process\", String.class); // signature changed\n// after\nReflections.findMethod(Foo.class, \"process\", String.class, Integer.class);","handlingStrategy":"validation","validationCode":"static void requireMethod(Class<?> clazz, String name, Class<?>... params) {\n    try { clazz.getDeclaredMethod(name, params); }\n    catch (NoSuchMethodException e) {\n        throw new IllegalStateException(\"Expected method \" + name + Arrays.asList(params) + \" on \" + clazz, e);\n    }\n}","typeGuard":"boolean hasMethod(Class<?> c, String n, Class<?>... p) {\n    try { c.getMethod(n, p); return true; } catch (NoSuchMethodException e) { return false; }\n}","tryCatchPattern":"try {\n    Method m = Reflections.findMethod(clazz, name, paramTypes);\n    return m.invoke(target, args);\n} catch (IllegalArgumentException e) {\n    throw new IllegalStateException(\"Reflective signature out of sync with \" + clazz.getName() + \" — update after upgrades\", e);\n}","preventionTips":["Pin and test reflective references against the exact dependency versions in use","Match primitive vs boxed parameter types exactly","Run upgrade tests that exercise all reflective call sites","Prefer MethodHandles or compile-time generated references where possible"],"tags":["reflection","arc","generated-code"],"backgroundTag":"method-not-found","analyzedSha":"e1c734241f34c7919086ceb4c9262b4a58f6de44","analyzedAt":"2026-09-05T17:01:29.979Z","contentChangedAt":"2026-09-05T17:01:29.979Z","schemaVersion":2},"datasetVersion":"2026-09-12T22:17:10.623Z"}