apache/iceberg · error · IllegalArgumentException
Cannot initialize AliyunClientFactory, missing no-arg constr
Error message
Cannot initialize AliyunClientFactory, missing no-arg constructor: %s
What it means
AliyunClientFactories.loadClientFactory resolves a custom AliyunClientFactory implementation class by name and requires a public no-arg constructor. If DynConstructors cannot find such a constructor (class missing, not public, or has required constructor args), it throws this IllegalArgumentException. This is a configuration/reflection error, not a runtime state error.
Source
Thrown at aliyun/src/main/java/org/apache/iceberg/aliyun/AliyunClientFactories.java:69
AliyunProperties.CLIENT_FACTORY,
DefaultAliyunClientFactory.class.getName());
return loadClientFactory(factoryImpl, properties);
}
/**
* Load an implemented {@link AliyunClientFactory} based on the class name, and initialize it.
*
* @param impl the class name.
* @param properties to initialize the factory.
* @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;View on GitHub (pinned to 86d9c8fc54)
Solutions
- Add a public no-arg constructor to your AliyunClientFactory implementation and read configuration from the passed properties map inside initialize().
- Make sure the implementation class is public, top-level (or public static nested), and on the classpath.
- Verify the fully-qualified class name configured in properties is spelled correctly.
- If you cannot change the class, use the built-in AliyunClientFactoryImpl instead.
Example fix
// before
public class MyFactory implements AliyunClientFactory {
public MyFactory(Map<String, String> props) { ... }
}
// after
public class MyFactory implements AliyunClientFactory {
public MyFactory() {}
@Override
public void initialize(Map<String, String> props) { ... }
} Defensive patterns
Strategy: validation
Validate before calling
Class<?> c = Class.forName(implClassName);
boolean ok = java.lang.reflect.Modifier.isPublic(c.getModifiers())
&& AliyunClientFactory.class.isAssignableFrom(c)
&& java.util.Arrays.stream(c.getConstructors())
.anyMatch(k -> k.getParameterCount() == 0); Prevention
- Always give custom factories a public no-arg constructor and read config in initialize().
- Keep factory classes public, static and top-level.
- Validate the class name config with a unit test that loads it reflectively.
When it happens
Trigger: Setting the property that names the factory impl (e.g. via catalog properties key `io-impl`/Aliyun factory class config) to a class that has no public no-arg constructor, or a class name that does not exist (NoSuchMethodException from missing default ctor path).
Common situations: Users write a custom OSS client factory with a constructor taking properties; users typo the class name; the class is package-private or inner (non-static) so no accessible no-arg ctor exists; obfuscated/shaded jars rename the class.
Understand the failure class
Background: "is required", "must be set", "missing required field": configuration validation errors across open-source libraries — this error's family across 36 libraries.
Related errors
- Cannot initialize AliyunClientFactory, %s does not implement
- Cannot initialize AwsClientFactory, missing no-arg construct
- Cannot initialize AwsClientFactory, %s does not implement Aw
- Cannot create %s to generate and configure the client SDK Pl
- Cannot initialize AdlsTokenCredentialProvider, missing no-ar
AI-assisted analysis of apache/iceberg@86d9c8fc54 (2026-09-12).
Data as JSON: /api/errors/d397ada6b4c4d996.
Report an issue: GitHub.