{"record":{"id":"3e1e9f394595a8a1","repo":"apache/dubbo","slug":"no-such-extension-name-for-the-class-in-the-con","errorCode":null,"errorMessage":"No such extension name for the class {} in the config {}","messagePattern":"No such extension name for the class (.+?) in the config (.+?)","errorType":"exception","errorClass":"IllegalStateException","httpStatus":null,"severity":"error","filePath":"dubbo-common/src/main/java/org/apache/dubbo/common/extension/ExtensionLoader.java","lineNumber":1293,"sourceCode":"                    \"Error occurred when loading extension class (interface: \" + type + \", class line: \"\n                            + clazz.getName() + \"), class \" + clazz.getName() + \" is not subtype of interface.\");\n        }\n\n        boolean isActive = loadClassIfActive(classLoader, clazz);\n\n        if (!isActive) {\n            return;\n        }\n\n        if (clazz.isAnnotationPresent(Adaptive.class)) {\n            cacheAdaptiveClass(clazz, overridden);\n        } else if (isWrapperClass(clazz)) {\n            cacheWrapperClass(clazz);\n        } else {\n            if (StringUtils.isEmpty(name)) {\n                name = findAnnotationName(clazz);\n                if (name.length() == 0) {\n                    throw new IllegalStateException(\"No such extension name for the class \" + clazz.getName()\n                            + \" in the config \" + resourceURL);\n                }\n            }\n\n            String[] names = NAME_SEPARATOR.split(name);\n            if (ArrayUtils.isNotEmpty(names)) {\n                cacheActivateClass(clazz, names[0]);\n                for (String n : names) {\n                    cacheName(clazz, n);\n                    saveInExtensionClass(extensionClasses, clazz, n, overridden);\n                }\n            }\n        }\n    }\n\n    private boolean loadClassIfActive(ClassLoader classLoader, Class<?> clazz) {\n        Activate activate = clazz.getAnnotation(Activate.class);\n","sourceCodeStart":1275,"sourceCodeEnd":1311,"githubUrl":"https://github.com/apache/dubbo/blob/3a3043227f5571d25eb2889de5bca22f2914843b/dubbo-common/src/main/java/org/apache/dubbo/common/extension/ExtensionLoader.java#L1275-L1311","documentation":"Thrown by loadClass() when an SPI config line has no name component and the class also lacks a derivable name from its @Extension annotation (via findAnnotationName). SPI config lines are normally 'name=com.example.Impl'; if only the class is given with no name prefix, and the class has no annotation providing a name, Dubbo cannot register it and throws.","triggerScenarios":"A META-INF SPI config line is written as '=com.example.Impl' (empty name) or as 'com.example.Impl' with no name= prefix and the class has no @Extension/@SPI-derivable annotation. findAnnotationName() returns an empty string, triggering the check at name.length() == 0.","commonSituations":"Hand-edited SPI config file missing the name= prefix; migration from java ServiceLoader format (which has no names) into Dubbo SPI format without adding the name; a class that previously had an @Extension annotation providing the name but the annotation was removed during refactor.","solutions":["Edit the SPI config line to include a name: 'myName=com.example.Impl'.","Alternatively, annotate the implementation class so Dubbo can derive the name automatically (the @Extension annotation or package/class naming convention).","Validate every line in your META-INF SPI files has the 'name=FQN' format before packaging."],"exampleFix":"# before: META-INF/dubbo/org.apache.dubbo.rpc.Protocol\ncom.example.MyProtocol\n# throws [147]\n\n# after\nmyproto=com.example.MyProtocol","handlingStrategy":"validation","validationCode":"// Build-time check: every SPI config line must be 'name=FQN' or the class must be annotated\nfor (String line : readSpiConfig(resourceUrl)) {\n    String trimmed = line.trim();\n    if (trimmed.isEmpty() || trimmed.startsWith(\"#\")) continue;\n    if (!trimmed.contains(\"=\")) {\n        // ensure the class has an @Extension annotation providing a name\n        Class<?> c = Class.forName(trimmed);\n        // else fail with a clear message\n    }\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always use the 'name=FQN' format in META-INF SPI config files.","Add a build-time test that parses every SPI config line and asserts the name= prefix presence.","Annotate implementation classes with @Extension so a name can be derived if the prefix is omitted."],"tags":["dubbo-spi","spi-config","naming","extension-loader"],"backgroundTag":null,"analyzedSha":"3a3043227f5571d25eb2889de5bca22f2914843b","analyzedAt":"2026-08-14T00:43:19.853Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}