{"record":{"id":"d32481bc08225214","repo":"apache/pulsar","slug":"field-name-with-value-o-does-not-impleme-d32481","errorCode":null,"errorMessage":"Field '${name}' with value '${o}' does not implement any of these classes ${Arrays.toString(classesImplements)}","messagePattern":"Field '(.+?)' with value '(.+?)' does not implement any of these classes (.+?)","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"pulsar-config-validation/src/main/java/org/apache/pulsar/config/validation/ValidatorImpls.java","lineNumber":201,"sourceCode":"                return;\n            }\n            SimpleTypeValidator.validateField(name, String.class, o);\n            String className = (String) o;\n            int count = 0;\n            for (Class<?> classImplements : classesImplements) {\n                Class<?> objectClass = null;\n                try {\n                    objectClass = loadClass(className);\n                } catch (ClassNotFoundException e) {\n                    throw new IllegalArgumentException(\"Cannot find/load class \" + className);\n                }\n\n                if (classImplements.isAssignableFrom(objectClass)) {\n                    count++;\n                }\n            }\n            if (count == 0) {\n                throw new IllegalArgumentException(\n                        String.format(\"Field '%s' with value '%s' does not implement any of these classes %s\",\n                                name, o, Arrays.toString(classesImplements)));\n            }\n        }\n    }\n\n    /**\n     * validates each key and each value against the respective arrays of validators.\n     */\n    public static class MapEntryCustomValidator extends Validator {\n\n        private Class<?>[] keyValidators;\n        private Class<?>[] valueValidators;\n\n        public MapEntryCustomValidator(Map<String, Object> params) {\n            this.keyValidators = (Class<?>[]) params.get(\n                    ConfigValidationAnnotations.ValidatorParams.KEY_VALIDATOR_CLASSES);\n            this.valueValidators = (Class<?>[]) params.get(","sourceCodeStart":183,"sourceCodeEnd":219,"githubUrl":"https://github.com/apache/pulsar/blob/820761864ed8e2a7d2e52dd9763ad2ae117c1395/pulsar-config-validation/src/main/java/org/apache/pulsar/config/validation/ValidatorImpls.java#L183-L219","documentation":"Thrown when the configured class loads successfully but implements none of the required interfaces/classes. The validator loops over every required type counting assignable matches; if count stays 0 after all checks, the field fails validation with the full list of accepted supertypes.","triggerScenarios":"A config field validated with a validator built from multiple classes (classesImplements) is set to a class name whose Class object satisfies none of them — count == 0 after the loop.","commonSituations":"User configures a valid class of the wrong family (e.g. a sink impl where a source impl is required); a refactored class dropped its interface; wrong version of a library where the interface set differs.","solutions":["Configure a class that implements at least one of the interfaces listed in the message.","Check the class's 'implements'/'extends' clauses against the required list and add the appropriate interface.","Verify the deployed jar version provides the implementation of the expected interface.","If you intended a different validator (single-interface), confirm the field is mapped to the right config key."],"exampleFix":"// before\nMyConfigurable cfg = new com.example.NotConfigurable(); // implements nothing required\n// after\npublic class MyConfigurableImpl implements Configurable { /* ... */ }\nMyConfigurable cfg = new com.example.MyConfigurableImpl();","handlingStrategy":"validation","validationCode":"boolean implementsAny(String className, Class<?>... required) {\n    try {\n        Class<?> c = Class.forName(className, false,\n            Thread.currentThread().getContextClassLoader());\n        for (Class<?> r : required) {\n            if (r.isAssignableFrom(c)) return true;\n        }\n    } catch (ClassNotFoundException ignored) { }\n    return false;\n}","typeGuard":null,"tryCatchPattern":"try {\n    validator.validateField(\"sourceClass\", className);\n} catch (IllegalArgumentException e) {\n    log.error(\"{} implements none of the required interfaces — see message for the accepted list\", className, e);\n    throw new ConfigurationException(e.getMessage(), e);\n}","preventionTips":["Confirm the class's implements/extends clauses match the interface family the field expects (source vs sink, codec vs filter).","Check the deployed jar's version actually provides the implementation.","Keep one config-key-to-interface mapping table in project docs.","Add an integration test that instantiates configured classes at boot."],"tags":["java","config-validation","typecheck","illegal-argument"],"backgroundTag":"config-class-does-not-implement-interface","analyzedSha":"820761864ed8e2a7d2e52dd9763ad2ae117c1395","analyzedAt":"2026-09-06T00:14:20.138Z","contentChangedAt":"2026-09-06T00:14:20.138Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}