apache/druid · error · ProvisionException

Problem instantiating object at prefix

Error message

Problem instantiating object at prefix[%s]: %s: %s.

What it means

JsonConfigurator.configurate() reflectively constructs the configured object (via a JSON-annotated constructor). If instantiation/invocation throws NoSuchMethodException, InstantiationException, IllegalAccessException, or InvocationTargetException, it is wrapped in this ProvisionException indicating the object at the given config prefix could not be constructed.

Solutions

  1. Look at the wrapped cause (InvocationTargetException target) for the real constructor failure and fix that input
  2. Verify the <x>.type value names a concrete, instantiable registered class
  3. Ensure the extension providing the class is loaded and on the classpath
  4. Check class constructor requirements (e.g. required args/annotations) after upgrades

Example fix

// before
-Ddruid.storage.type=org.apache.druid.storage.custom.MyStore  // abstract class
// after
-Ddruid.storage.type=org.apache.druid.storage.custom.MyStoreImpl
Defensive patterns

Strategy: try-catch

Validate before calling

Class<?> clazz = jsonMapper.convertValue(map, Object.class).getClass();
// verify the configured type resolves to a concrete instantiable class
Assert.assertFalse(Modifier.isAbstract(clazz.getModifiers()));

Try / catch

try { startDruid(); } catch (ProvisionException e) {
  if (e.getMessage().startsWith("Problem instantiating object at prefix")) {
    log.error("Constructor failed for {}: {}", extractPrefix(e.getMessage()), e.getCause(), e);
  }
  throw e;
}

Prevention

When it happens

Trigger: The configured class has no matching @JsonCreator constructor for the map, is abstract/interface, its constructor throws, or constructor access is restricted — all during Guice provider creation for a config-backed object.

Common situations: Configuring druid.<x>.type pointing to a class whose constructor throws due to invalid internal setup; pointing a config at an interface/abstract type; extension class present in loadList issues so its creator isn't visible; refactored class removing the old creator signature.

Related errors


AI-assisted analysis of apache/druid@9b90983fd2 (2026-09-07). Data as JSON: /api/errors/08d8071ddb2ab90f. Report an issue: GitHub.

Appendix: source

Thrown at processing/src/main/java/org/apache/druid/guice/JsonConfigurator.java:151

        // using the JsonCreator annotated factory method or no-arg constructor.
        // We know it exists because verifyClazzIsConfigurable checks for it.
        Optional<Method> factoryMethod = findJsonCreatorFactoryMethod(defaultClass);
        if (factoryMethod.isPresent()) {
          config = (T) factoryMethod.get().invoke(null);
        } else {
          config = defaultClass.getConstructor().newInstance();
        }
      } else {
        config = jsonMapper.convertValue(jsonMap, clazz);
      }
    }
    catch (IllegalArgumentException e) {
      throw new ProvisionException(
          StringUtils.format("Problem parsing object at prefix[%s]: %s.", propertyPrefix, e.getMessage()), e
      );
    }
    catch (NoSuchMethodException | InstantiationException | IllegalAccessException | InvocationTargetException e) {
      throw new ProvisionException(
          StringUtils.format(
              "Problem instantiating object at prefix[%s]: %s: %s.",
              propertyPrefix,
              e.getClass().getSimpleName(),
              e.getMessage()
          ),
          e
      );
    }

    final Set<ConstraintViolation<T>> violations = validator.validate(config);
    if (!violations.isEmpty()) {
      List<String> messages = new ArrayList<>();

      for (ConstraintViolation<T> violation : violations) {
        StringBuilder path = new StringBuilder();
        try {
          Class<?> beanClazz = violation.getRootBeanClass();

View on GitHub (pinned to 9b90983fd2)