apache/incubator-seata · error · EnhancedServiceNotFoundException
not found service provider for : {}
Error message
not found service provider for : {} What it means
getExtensionInstance throws this plain EnhancedServiceNotFoundException when the resolved ExtensionDefinition is null — i.e. the loader was asked for a definition it does not have. For the by-name path this means no provider is registered under that activateName; for the default path it means no default provider is discoverable at all.
Source
Thrown at common/src/main/java/org/apache/seata/common/loader/EnhancedServiceLoader.java:472
}
try {
loadAllExtensionClass(loader, includeCompatible);
ExtensionDefinition<S> cachedExtensionDefinition = getCachedExtensionDefinition(activateName);
return getExtensionInstance(cachedExtensionDefinition, loader, argTypes, args);
} catch (Throwable e) {
if (e instanceof EnhancedServiceNotFoundException) {
throw (EnhancedServiceNotFoundException) e;
} else {
throw new EnhancedServiceNotFoundException("not found service provider for : " + type.getName()
+ " caused by " + ExceptionUtils.getStackTrace(e));
}
}
}
private S getExtensionInstance(
ExtensionDefinition<S> definition, ClassLoader loader, Class<?>[] argTypes, Object[] args) {
if (definition == null) {
throw new EnhancedServiceNotFoundException("not found service provider for : " + type.getName());
}
if (Scope.SINGLETON.equals(definition.getScope())) {
Holder<Object> holder =
CollectionUtils.computeIfAbsent(definitionToInstanceMap, definition, key -> new Holder<>());
Object instance = holder.get();
if (instance == null) {
synchronized (holder) {
instance = holder.get();
if (instance == null) {
instance = createNewExtension(definition, loader, argTypes, args);
holder.set(instance);
}
}
}
return (S) instance;
} else {
return createNewExtension(definition, loader, argTypes, args);
}View on GitHub (pinned to e01f97c6db)
Solutions
- Check the requested provider name against the names registered in the provider jar's META-INF/services file.
- Add the dependency jar that contains the provider for that name (e.g. seata-serializer-seata, seata-mysql).
- Fix fat-jar packaging with ServicesResourceTransformer to preserve service descriptors.
- Verify classloader visibility in app-server/OSGi environments.
Example fix
# before: seata.serializer="seataa" # typo, no provider registered # after: seata.serializer="seata"
Defensive patterns
Strategy: validation
Validate before calling
// Validate config values against registered SPI names before load
Set<String> registeredNames = readSpiNames("META-INF/services/" + SpiType.class.getName());
if (!registeredNames.contains(configuredName)) {
throw new IllegalArgumentException("Unknown provider '" + configuredName + "', valid: " + registeredNames);
} Try / catch
try {
T provider = EnhancedServiceLoader.load(SpiType.class, name);
} catch (EnhancedServiceNotFoundException e) {
// message has no 'caused by' -> provider truly unregistered;
// surface list of registered names to the user for a quick fix
throw e;
} Prevention
- Validate provider names in configuration at startup against the registered SPI set.
- Keep seata extension modules (serializer, config, registry providers) on the classpath when their names are configured.
- Preserve META-INF/services in shaded jars with ServicesResourceTransformer.
When it happens
Trigger: EnhancedServiceLoader.load(Spi.class, name) where no META-INF/services entry declares that name; or the default lookup finds zero providers (service file missing, empty, or not visible to the classloader).
Common situations: Typo in the provider name in configuration (e.g. serializer/db-vs-mysql names); the SPI service descriptor file was not copied into the jar; seata optional dependency jars omitted; shading dropped META-INF/services.
Related errors
- not found service provider for : {} caused by {}
- No JsonCodec provider found. Please add json-common-core to
- Extension instance(definition: {}, class: {}) could not be
- unknown lock mode:{}
- unknown session mode:{}
AI-assisted analysis of apache/incubator-seata@e01f97c6db (2026-08-14).
Data as JSON: /api/errors/a52a294ce6619f74.
Report an issue: GitHub.