{"record":{"id":"d397ada6b4c4d996","repo":"apache/iceberg","slug":"cannot-initialize-aliyunclientfactory-missing-no","errorCode":null,"errorMessage":"Cannot initialize AliyunClientFactory, missing no-arg constructor: %s","messagePattern":"Cannot initialize AliyunClientFactory, missing no-arg constructor: (.+?)","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"aliyun/src/main/java/org/apache/iceberg/aliyun/AliyunClientFactories.java","lineNumber":69,"sourceCode":"            AliyunProperties.CLIENT_FACTORY,\n            DefaultAliyunClientFactory.class.getName());\n    return loadClientFactory(factoryImpl, properties);\n  }\n\n  /**\n   * Load an implemented {@link AliyunClientFactory} based on the class name, and initialize it.\n   *\n   * @param impl the class name.\n   * @param properties to initialize the factory.\n   * @return an initialized {@link AliyunClientFactory}.\n   */\n  private static AliyunClientFactory loadClientFactory(\n      String impl, Map<String, String> properties) {\n    DynConstructors.Ctor<AliyunClientFactory> ctor;\n    try {\n      ctor = DynConstructors.builder(AliyunClientFactory.class).hiddenImpl(impl).buildChecked();\n    } catch (NoSuchMethodException e) {\n      throw new IllegalArgumentException(\n          String.format(\n              \"Cannot initialize AliyunClientFactory, missing no-arg constructor: %s\", impl),\n          e);\n    }\n\n    AliyunClientFactory factory;\n    try {\n      factory = ctor.newInstance();\n    } catch (ClassCastException e) {\n      throw new IllegalArgumentException(\n          String.format(\n              \"Cannot initialize AliyunClientFactory, %s does not implement AliyunClientFactory.\",\n              impl),\n          e);\n    }\n\n    factory.initialize(properties);\n    return factory;","sourceCodeStart":51,"sourceCodeEnd":87,"githubUrl":"https://github.com/apache/iceberg/blob/86d9c8fc543e7c56c9f624eb725f76c9baff9570/aliyun/src/main/java/org/apache/iceberg/aliyun/AliyunClientFactories.java#L51-L87","documentation":"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.","triggerScenarios":"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).","commonSituations":"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.","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."],"exampleFix":"// before\npublic class MyFactory implements AliyunClientFactory {\n  public MyFactory(Map<String, String> props) { ... }\n}\n\n// after\npublic class MyFactory implements AliyunClientFactory {\n  public MyFactory() {}\n\n  @Override\n  public void initialize(Map<String, String> props) { ... }\n}","handlingStrategy":"validation","validationCode":"Class<?> c = Class.forName(implClassName);\nboolean ok = java.lang.reflect.Modifier.isPublic(c.getModifiers())\n    && AliyunClientFactory.class.isAssignableFrom(c)\n    && java.util.Arrays.stream(c.getConstructors())\n        .anyMatch(k -> k.getParameterCount() == 0);","typeGuard":null,"tryCatchPattern":null,"preventionTips":["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."],"tags":["reflection","configuration","aliyun"],"backgroundTag":"missing-required-config-field","analyzedSha":"86d9c8fc543e7c56c9f624eb725f76c9baff9570","analyzedAt":"2026-09-12T00:46:39.097Z","contentChangedAt":"2026-09-12T00:46:39.097Z","schemaVersion":2},"datasetVersion":"2026-09-14T11:17:12.474Z"}