apache/dubbo · error · IllegalStateException
No such extension name for the class {} in the config {}
Error message
No such extension name for the class {} in the config {} What it means
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.
Source
Thrown at dubbo-common/src/main/java/org/apache/dubbo/common/extension/ExtensionLoader.java:1293
"Error occurred when loading extension class (interface: " + type + ", class line: "
+ clazz.getName() + "), class " + clazz.getName() + " is not subtype of interface.");
}
boolean isActive = loadClassIfActive(classLoader, clazz);
if (!isActive) {
return;
}
if (clazz.isAnnotationPresent(Adaptive.class)) {
cacheAdaptiveClass(clazz, overridden);
} else if (isWrapperClass(clazz)) {
cacheWrapperClass(clazz);
} else {
if (StringUtils.isEmpty(name)) {
name = findAnnotationName(clazz);
if (name.length() == 0) {
throw new IllegalStateException("No such extension name for the class " + clazz.getName()
+ " in the config " + resourceURL);
}
}
String[] names = NAME_SEPARATOR.split(name);
if (ArrayUtils.isNotEmpty(names)) {
cacheActivateClass(clazz, names[0]);
for (String n : names) {
cacheName(clazz, n);
saveInExtensionClass(extensionClasses, clazz, n, overridden);
}
}
}
}
private boolean loadClassIfActive(ClassLoader classLoader, Class<?> clazz) {
Activate activate = clazz.getAnnotation(Activate.class);
View on GitHub (pinned to 3a3043227f)
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.
Example fix
# before: META-INF/dubbo/org.apache.dubbo.rpc.Protocol com.example.MyProtocol # throws [147] # after myproto=com.example.MyProtocol
Defensive patterns
Strategy: validation
Validate before calling
// Build-time check: every SPI config line must be 'name=FQN' or the class must be annotated
for (String line : readSpiConfig(resourceUrl)) {
String trimmed = line.trim();
if (trimmed.isEmpty() || trimmed.startsWith("#")) continue;
if (!trimmed.contains("=")) {
// ensure the class has an @Extension annotation providing a name
Class<?> c = Class.forName(trimmed);
// else fail with a clear message
}
} Prevention
- 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.
When it happens
Trigger: 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.
Common situations: 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.
Related errors
- Error occurred when loading extension class (interface: {},
- Extension instance (name: {}, class: {}) couldn't be instant
- Extension type == null
- Exception occurred when loading extension class (interface:
- More than 1 default extension name on extension {}: {}
AI-assisted analysis of apache/dubbo@3a3043227f (2026-08-14).
Data as JSON: /api/errors/3e1e9f394595a8a1.
Report an issue: GitHub.