apache/iceberg · error · IllegalArgumentException
Cannot initialize AliyunClientFactory, %s does not implement
Error message
Cannot initialize AliyunClientFactory, %s does not implement AliyunClientFactory.
What it means
After reflectively instantiating the configured factory class, loadClientFactory casts the result to AliyunClientFactory. If the created object does not implement that interface, the ClassCastException is rethrown as this IllegalArgumentException. The configured class simply is not the right type.
Source
Thrown at aliyun/src/main/java/org/apache/iceberg/aliyun/AliyunClientFactories.java:79
* @return an initialized {@link AliyunClientFactory}.
*/
private static AliyunClientFactory loadClientFactory(
String impl, Map<String, String> properties) {
DynConstructors.Ctor<AliyunClientFactory> ctor;
try {
ctor = DynConstructors.builder(AliyunClientFactory.class).hiddenImpl(impl).buildChecked();
} catch (NoSuchMethodException e) {
throw new IllegalArgumentException(
String.format(
"Cannot initialize AliyunClientFactory, missing no-arg constructor: %s", impl),
e);
}
AliyunClientFactory factory;
try {
factory = ctor.newInstance();
} catch (ClassCastException e) {
throw new IllegalArgumentException(
String.format(
"Cannot initialize AliyunClientFactory, %s does not implement AliyunClientFactory.",
impl),
e);
}
factory.initialize(properties);
return factory;
}
static class DefaultAliyunClientFactory implements AliyunClientFactory {
private static final Logger LOG = LoggerFactory.getLogger(DefaultAliyunClientFactory.class);
private AliyunProperties aliyunProperties;
DefaultAliyunClientFactory() {}
/**
* Check if RRSA environment variables are present. RRSA requiresView on GitHub (pinned to 86d9c8fc54)
Solutions
- Make the configured class implement org.apache.iceberg.aliyun.AliyunClientFactory.
- Check for duplicate/conflicting jars on the classpath (old version of your factory jar shadowing a newer one).
- Confirm the fully-qualified class name points at the factory, not at a client or properties class.
Example fix
// before
public class MyOSSHelper { }
// after
public class MyOSSHelper implements AliyunClientFactory {
public MyOSSHelper() {}
// implement interface methods
} Defensive patterns
Strategy: type-guard
Validate before calling
Class<?> c = Class.forName(implClassName);
if (!AliyunClientFactory.class.isAssignableFrom(c)) {
throw new IllegalStateException(implClassName + " does not implement AliyunClientFactory");
} Type guard
if (obj instanceof AliyunClientFactory) { AliyunClientFactory f = (AliyunClientFactory) obj; } Prevention
- Verify the configured class implements AliyunClientFactory before wiring it into properties.
- Check classpath for duplicate/stale jars of your factory.
- Add a startup smoke test that instantiates the factory by name.
When it happens
Trigger: Setting the factory impl property to a class that exists and has a no-arg constructor but does not implement org.apache.iceberg.aliyun.AliyunClientFactory (e.g. an OSS client, a different vendor's factory, or a stale class).
Common situations: Copy-pasting a factory class name from a different catalog implementation (Hadoop/S3/Aliyun mixups); a refactor renamed/moved the interface so an old jar still has the pre-interface class; shading changed the package.
Understand the failure class
Background: Type mismatch errors: IllegalArgumentException, TypeError and type guards across 150 open-source libraries — this error's family across 150 libraries.
Related errors
- Cannot initialize AliyunClientFactory, missing no-arg constr
- Cannot initialize AdlsTokenCredentialProvider, %s does not i
- Cannot initialize Catalog, %s does not implement Catalog.
- Cannot initialize FileIO, %s does not implement FileIO.
- Cannot initialize MetricsReporter, %s does not implement Met
AI-assisted analysis of apache/iceberg@86d9c8fc54 (2026-09-12).
Data as JSON: /api/errors/dbe08279f2017639.
Report an issue: GitHub.