{"record":{"id":"834c05b1488b24e4","repo":"apache/pulsar","slug":"config-class-not-found-s","errorCode":null,"errorMessage":"Config class not found: %s","messagePattern":"Config class not found: (.+?)","errorType":"exception","errorClass":"RuntimeException","httpStatus":null,"severity":"error","filePath":"pulsar-functions/instance/src/main/java/org/apache/pulsar/functions/instance/JavaInstanceRunnable.java","lineNumber":1043,"sourceCode":"        interpolateSecretsIntoConfigs(secretsProvider, config);\n\n        if (instanceConfig.isIgnoreUnknownConfigFields() && componentClassLoader instanceof NarClassLoader) {\n            final String configClassName;\n            if (componentType == FunctionDetails.ComponentType.SOURCE) {\n                configClassName = ConnectorUtils\n                        .getConnectorDefinition((NarClassLoader) componentClassLoader).getSourceConfigClass();\n            } else {\n                configClassName =  ConnectorUtils\n                        .getConnectorDefinition((NarClassLoader) componentClassLoader).getSinkConfigClass();\n            }\n            if (configClassName != null) {\n\n                Class<?> configClass;\n                try {\n                    configClass = Class.forName(configClassName,\n                            true, Thread.currentThread().getContextClassLoader());\n                } catch (ClassNotFoundException e) {\n                    throw new RuntimeException(\"Config class not found: \" + configClassName, e);\n                }\n                final List<String> allFields = BeanPropertiesReader.getBeanProperties(configClass);\n\n                for (String s : config.keySet()) {\n                    if (!allFields.contains(s)) {\n                        log.error()\n                                .attr(\"field\", s)\n                                .attr(\"componentType\", componentType)\n                                .attr(\"configClass\", configClass)\n                                .log(\"Field not defined in the configuration,\"\n                                        + \" the field will be ignored\");\n                        config.remove(s);\n                    }\n                }\n            }\n        }\n        return config;\n    }","sourceCodeStart":1025,"sourceCodeEnd":1061,"githubUrl":"https://github.com/apache/pulsar/blob/820761864ed8e2a7d2e52dd9763ad2ae117c1395/pulsar-functions/instance/src/main/java/org/apache/pulsar/functions/instance/JavaInstanceRunnable.java#L1025-L1061","documentation":"The function declares a typed config (configClassName in FunctionDetails) but Class.forName cannot load that class from the component classloader during instance construction. The runtime needs the config class to reflect over its bean properties and inject user configuration, so it fails hard wrapping the ClassNotFoundException.","triggerScenarios":"The className string in the function config doesn't match the fully-qualified name of a class in the function JAR; the JAR containing the config class wasn't uploaded; the class is in the uber JAR but shaded/moved by a relocation rule; typo in package name.","commonSituations":"Renaming the config class package without redeploying the JAR; building the function with shading that relocates the config class; specifying an inner class name with wrong separator (Foo.Bar vs Foo$Bar); deploying a source/sink JAR that omits the config class.","solutions":["Verify the exact fully-qualified class name in the function config matches a class present in the uploaded JAR (unzip -l function.jar)","If using maven-shade, ensure the config class package is not relocated, or update the config className accordingly","Rebuild and redeploy the JAR containing the config class before submitting/updating the function","For nested classes use the binary name with $ (com.example.Foo$Config)"],"exampleFix":"// before (function config)\n{\"className\":\"com.acme.MySource\",\"configClassName\":\"com.acme.MyOldSourceConfig\"}\n// after\n{\"className\":\"com.acme.MySource\",\"configClassName\":\"com.acme.MySourceConfig\"}","handlingStrategy":"validation","validationCode":"String cn = details.getConfigClassName();\nClass.forName(cn, true, functionClassLoader); // fails fast before submission","typeGuard":null,"tryCatchPattern":"try { submitFunction(cfg); }\ncatch (RuntimeException e) {\n  if (e.getMessage().startsWith(\"Config class not found\")) {\n    log.error(\"Verify configClassName exists in the uploaded JAR\", e);\n  }\n}","preventionTips":["Keep configClassName in sync when renaming/refactoring packages","Check JAR contents (unzip -l) for the config class before uploading","Avoid shade-plugin relocations of config classes","Use binary names with $ for nested config classes"],"tags":["java","pulsar-functions","classpath","config","class-not-found"],"backgroundTag":"class-not-found","analyzedSha":"820761864ed8e2a7d2e52dd9763ad2ae117c1395","analyzedAt":"2026-09-06T00:14:20.138Z","contentChangedAt":"2026-09-06T00:14:20.138Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}