quarkusio/quarkus · critical · RuntimeException

Failed to initialize converters for injected class${i.getInj

Error message

Failed to initialize converters for injected class${i.getInjectedClassName()}

What it means

FieldInjectionFeature.runtimeInit runs at runtime startup and reflectively invokes generated Deployment init methods that register converters for classes with injected fields. If loading the class, locating the method, or invoking it fails, startup aborts with this RuntimeException wrapping the underlying cause.

Source

Thrown at independent-projects/resteasy-reactive/server/processor/src/main/java/org/jboss/resteasy/reactive/server/processor/generation/injection/FieldInjectionFeature.java:31

public class FieldInjectionFeature extends AbstractFeatureScanner {

    final List<InjectedClassConverterField> initMethods = new ArrayList<>();

    @Override
    public void integrateWithIndexer(ServerEndpointIndexer.Builder builder, IndexView index) {
        builder.setFieldInjectionIndexerExtension(
                new TransformedFieldInjectionIndexerExtension(transformations::put, true, initMethods::add));

    }

    public void runtimeInit(ClassLoader classLoader, Deployment deployment) {
        for (InjectedClassConverterField i : initMethods) {
            try {
                Class<?> theClass = Class.forName(i.getInjectedClassName().replace("/", "."), false, classLoader);
                Method theMethod = theClass.getDeclaredMethod(i.getMethodName(), Deployment.class);
                theMethod.invoke(null, deployment);
            } catch (Exception e) {
                throw new RuntimeException("Failed to initialize converters for injected class" + i.getInjectedClassName(), e);
            }
        }
    }
}

View on GitHub (pinned to e1c734241f)

Solutions

  1. Inspect the wrapped cause (`e`) to see whether Class.forName, getDeclaredMethod or invoke failed.
  2. Ensure the class named in the message is on the runtime classpath and not excluded by native/packaging config.
  3. Run a clean rebuild (`mvn clean verify`) to regenerate injection metadata in sync with classes.
  4. If it reproduces on a clean build, report it upstream — this is generated-code plumbing, usually a framework bug.
Defensive patterns

Strategy: try-catch

Validate before calling

// Verify the generated class is loadable before startup:
try {
    Class.forName(injectedClassName.replace("/", "."), false,
        Thread.currentThread().getContextClassLoader());
} catch (ClassNotFoundException e) {
    throw new IllegalStateException("Injected class missing at runtime: " + injectedClassName, e);
}

Try / catch

try {
    application.start();
} catch (RuntimeException e) {
    if (e.getMessage() != null
            && e.getMessage().startsWith("Failed to initialize converters for injected class")) {
        LOG.error("Build/runtime metadata mismatch: run a clean build and check native packaging config", e);
    }
    throw e;
}

Prevention

When it happens

Trigger: Application startup when the generated init method for an injected class cannot be loaded (class name mismatch, wrong classloader, class missing from the runtime classpath) or the target method is absent/signature changed.

Common situations: Native-image or fat-jar builds where generated classes were excluded by configuration; classloader isolation with custom classloaders; version mismatch between build-time generated metadata and runtime classes after partial rebuilds.

Related errors


AI-assisted analysis of quarkusio/quarkus@e1c734241f (2026-09-05). Data as JSON: /api/errors/0f8ce91896d5ce32. Report an issue: GitHub.