quarkusio/quarkus · critical · IllegalStateException

IllegalStateException wrapping ClassNotFoundException for ge

Error message

IllegalStateException wrapping ClassNotFoundException for generated static-method initializer class (no own message)

What it means

This IllegalStateException is thrown by InterceptedStaticMethodsRecorder.callInitializer when Class.forName cannot find the generated static-method initializer class (INITIALIZER_CLASS_NAME). The initializer class is generated at build time by the ArC deployment step that supports intercepted static methods; if it is missing at runtime, the CDI intercepted-static-methods integration is broken. The ClassNotFoundException is wrapped to preserve the cause while surfacing a runtime failure.

Source

Thrown at extensions/arc/runtime/src/main/java/io/quarkus/arc/runtime/InterceptedStaticMethodsRecorder.java:19

package io.quarkus.arc.runtime;

import io.quarkus.runtime.annotations.Recorder;

@Recorder
public class InterceptedStaticMethodsRecorder {

    // This class is generated and calls all generated static interceptor initializers to register metadata in the InterceptedStaticMethods class
    public static final String INITIALIZER_CLASS_NAME = "io.quarkus.arc.runtime.InterceptedStaticMethodsInitializer";

    public void callInitializer() {
        ClassLoader cl = Thread.currentThread().getContextClassLoader();
        if (cl == null) {
            cl = InterceptedStaticMethodsRecorder.class.getClassLoader();
        }
        try {
            Class.forName(INITIALIZER_CLASS_NAME, true, cl);
        } catch (ClassNotFoundException e) {
            throw new IllegalStateException(e);
        }
    }

}

View on GitHub (pinned to e1c734241f)

Solutions

  1. Verify the ArC deployment build step for intercepted static methods ran and the generated initializer class exists in the application bytecode
  2. Ensure the ClassLoader passed to callInitializer can load classes generated for the application (try the Thread.currentThread().getContextClassLoader() or the application classloader)
  3. Rebuild the application cleanly so the deployment-time code generation re-runs
  4. Check that packaging tooling (shade plugins, native-image config) is not excluding the generated initializer class

Example fix

// before
InterceptedStaticMethodsRecorder.callInitializer("com.example.App", "start", someRestrictedClassLoader);
// after
InterceptedStaticMethodsRecorder.callInitializer("com.example.App", "start",
        Thread.currentThread().getContextClassLoader());
Defensive patterns

Strategy: try-catch

Validate before calling

try {
    Class.forName("io.quarkus.arc.runtime.InterceptedStaticMethodsRecorder$$StaticInit", true, cl);
} catch (ClassNotFoundException e) {
    throw new IllegalStateException("Static-method initializer class missing; rebuild the app", e);
}

Type guard

boolean initializerPresent(ClassLoader cl) {
    try { Class.forName("io.quarkus.arc.runtime.InterceptedStaticMethodsRecorder$$StaticInit", false, cl); return true; }
    catch (ClassNotFoundException e) { return false; }
}

Try / catch

try {
    recorder.callInitializer(cls, methodName, cl);
} catch (IllegalStateException e) {
    logger.error("Generated static initializer not found; check ArC build output", e);
}

Prevention

When it happens

Trigger: Calling InterceptedStaticMethodsRecorder.callInitializer(String, String, ClassLoader) at application startup when the build-time-generated initializer class is absent from the classloader hierarchy (e.g. wrong classloader passed, or the deployment code generation step did not run).

Common situations: Custom launchers or dev-mode tooling invoking callInitializer with a classloader that cannot see generated classes; upgrades where the intercepted static methods bytecode generation was skipped or its output excluded; packaging the app in a way that drops generated classes.

Related errors


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