{"record":{"id":"0f8ce91896d5ce32","repo":"quarkusio/quarkus","slug":"failed-to-initialize-converters-for-injected-class","errorCode":null,"errorMessage":"Failed to initialize converters for injected class${i.getInjectedClassName()}","messagePattern":"Failed to initialize converters for injected class(.+?)","errorType":"exception","errorClass":"RuntimeException","httpStatus":null,"severity":"critical","filePath":"independent-projects/resteasy-reactive/server/processor/src/main/java/org/jboss/resteasy/reactive/server/processor/generation/injection/FieldInjectionFeature.java","lineNumber":31,"sourceCode":"public class FieldInjectionFeature extends AbstractFeatureScanner {\n\n    final List<InjectedClassConverterField> initMethods = new ArrayList<>();\n\n    @Override\n    public void integrateWithIndexer(ServerEndpointIndexer.Builder builder, IndexView index) {\n        builder.setFieldInjectionIndexerExtension(\n                new TransformedFieldInjectionIndexerExtension(transformations::put, true, initMethods::add));\n\n    }\n\n    public void runtimeInit(ClassLoader classLoader, Deployment deployment) {\n        for (InjectedClassConverterField i : initMethods) {\n            try {\n                Class<?> theClass = Class.forName(i.getInjectedClassName().replace(\"/\", \".\"), false, classLoader);\n                Method theMethod = theClass.getDeclaredMethod(i.getMethodName(), Deployment.class);\n                theMethod.invoke(null, deployment);\n            } catch (Exception e) {\n                throw new RuntimeException(\"Failed to initialize converters for injected class\" + i.getInjectedClassName(), e);\n            }\n        }\n    }\n}\n","sourceCodeStart":13,"sourceCodeEnd":36,"githubUrl":"https://github.com/quarkusio/quarkus/blob/e1c734241f34c7919086ceb4c9262b4a58f6de44/independent-projects/resteasy-reactive/server/processor/src/main/java/org/jboss/resteasy/reactive/server/processor/generation/injection/FieldInjectionFeature.java#L13-L36","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Inspect the wrapped cause (`e`) to see whether Class.forName, getDeclaredMethod or invoke failed.","Ensure the class named in the message is on the runtime classpath and not excluded by native/packaging config.","Run a clean rebuild (`mvn clean verify`) to regenerate injection metadata in sync with classes.","If it reproduces on a clean build, report it upstream — this is generated-code plumbing, usually a framework bug."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"// Verify the generated class is loadable before startup:\ntry {\n    Class.forName(injectedClassName.replace(\"/\", \".\"), false,\n        Thread.currentThread().getContextClassLoader());\n} catch (ClassNotFoundException e) {\n    throw new IllegalStateException(\"Injected class missing at runtime: \" + injectedClassName, e);\n}","typeGuard":null,"tryCatchPattern":"try {\n    application.start();\n} catch (RuntimeException e) {\n    if (e.getMessage() != null\n            && e.getMessage().startsWith(\"Failed to initialize converters for injected class\")) {\n        LOG.error(\"Build/runtime metadata mismatch: run a clean build and check native packaging config\", e);\n    }\n    throw e;\n}","preventionTips":["Run `mvn clean` after Quarkus upgrades to avoid stale generated metadata.","Do not exclude generated classes (e.g. `$$`-suffixed) from native/jar packaging configs.","Keep build-time and runtime artifacts from the same build.","Always inspect the wrapped cause exception for the real failure."],"tags":["quarkus","resteasy-reactive","startup","injection","reflection"],"backgroundTag":"runtime-initialization-failed","analyzedSha":"e1c734241f34c7919086ceb4c9262b4a58f6de44","analyzedAt":"2026-09-05T17:01:29.979Z","contentChangedAt":"2026-09-05T17:01:29.979Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}