apache/iceberg · error · UnsupportedOperationException

Failed to load Configuration.setConf after loading Configura

Error message

Failed to load Configuration.setConf after loading Configurable

What it means

After loading a Configurable and its Hadoop Configuration class, configureHadoopConf reflectively looks up the setConf(Configuration) method and binds it to the instance. If setConf cannot be found on the loaded Configurable, this UnsupportedOperationException is thrown. It is an internal-invariant error: any class implementing Configurable must define setConf, so this signals an unexpectedly malformed or mismatched class.

Source

Thrown at core/src/main/java/org/apache/iceberg/CatalogUtil.java:497

          "Failed to load Configuration after loading Configurable", e);
    }

    ValidationException.check(
        configurationClass.isInstance(conf),
        "%s is not an instance of Configuration from the classloader for %s",
        conf,
        maybeConfigurable);

    DynMethods.BoundMethod setConf;
    try {
      setConf =
          DynMethods.builder("setConf")
              .impl(configurableInterface, configurationClass)
              .buildChecked()
              .bind(maybeConfigurable);
    } catch (NoSuchMethodException e) {
      // this shouldn't happen because Configurable was loaded and defines setConf
      throw new UnsupportedOperationException(
          "Failed to load Configuration.setConf after loading Configurable", e);
    }

    setConf.invoke(conf);
  }

  /**
   * Load a custom {@link MetricsReporter} implementation.
   *
   * <p>The implementation must have a no-arg constructor.
   *
   * @param properties catalog properties which contains class name of a custom {@link
   *     MetricsReporter} implementation
   * @return An initialized {@link MetricsReporter}.
   * @throws IllegalArgumentException if class path not found or right constructor not found or the
   *     loaded class cannot be cast to the given interface type
   */
  public static MetricsReporter loadMetricsReporter(Map<String, String> properties) {

View on GitHub (pinned to 86d9c8fc54)

Solutions

  1. Ensure only one copy of org.apache.hadoop.conf.Configurable exists on the classpath (no duplicate/relocated hadoop jars).
  2. Make sure the same classloader loads the implementation, Configurable, and Configuration classes.
  3. Check shade plugin excludes so hadoop configuration classes are not relocated in plugin jars.
  4. Align hadoop-common versions between the application and the catalog/FileIO plugin.
Defensive patterns

Strategy: try-catch

Validate before calling

Class<?> implClass = Class.forName(implName, true, loader);
if (!org.apache.hadoop.conf.Configurable.class.isAssignableFrom(implClass)) {
  throw new IllegalStateException("implementation is not a Hadoop Configurable");
}

Type guard

boolean definesSetConf(Class<?> c, ClassLoader cl) {
  try {
    Class<?> conf = Class.forName("org.apache.hadoop.conf.Configuration", false, cl);
    return java.lang.reflect.Modifier.isPublic(c.getModifiers())
        && java.util.Arrays.stream(c.getMethods())
            .anyMatch(m -> m.getName().equals("setConf")
                && m.getParameterCount() == 1 && m.getParameterTypes()[0] == conf);
  } catch (ClassNotFoundException e) { return false; }
}

Try / catch

try {
  CatalogUtil.loadFileIO(fileIOImpl, properties, hadoopConf);
} catch (UnsupportedOperationException e) {
  if (e.getMessage() != null && e.getMessage().contains("setConf")) {
    // duplicated/relocated Configurable classes — log classloader sources before rethrowing
  }
  throw e;
}

Prevention

When it happens

Trigger: CatalogUtil.loadCatalog or loadFileIO receives a class whose Configurable interface was loaded from a different classloader than the instance's own classloader, so DynMethods cannot resolve setConf(Configuration) with the Configuration class argument; or the class implements a relocated/shaded Configurable variant.

Common situations: Shading that relocates org.apache.hadoop.conf.Configurable on one side but not the other; mixed Hadoop versions on the classpath; custom classloaders loading duplicate copies of Configurable/Configuration.

Related errors


AI-assisted analysis of apache/iceberg@86d9c8fc54 (2026-09-12). Data as JSON: /api/errors/379a102d0d4765f8. Report an issue: GitHub.