quarkusio/quarkus · error · java.lang.IllegalStateException

Unable to create global provider:

Error message

Unable to create global provider: 

What it means

EngineProducer.createGlobalProvider wraps all reflective failures when instantiating a configured TemplateGlobalProvider into this IllegalStateException, with the underlying exception as cause. The message appends initializerClassName from the quarkus.qute.global-provider.<n>.classes config.

Solutions

  1. Inspect the cause chain to identify missing class vs missing constructor vs constructor exception.
  2. Correct the class name or add the missing dependency/module.
  3. Give the provider a public no-arg constructor.
  4. For native image, ensure the class is registered for reflection (Quarkus usually handles config-referenced classes — verify your build).

Example fix

// before
class MyGlobals { public MyGlobals(String cfg) {...} } // no no-arg ctor
// after
class MyGlobals { public MyGlobals() {...} }
Defensive patterns

Strategy: validation

Validate before calling

try { Class.forName("com.example.MyGlobals").getConstructor(); } catch (ClassNotFoundException | NoSuchMethodException e) { throw new IllegalStateException("Provider missing or lacks no-arg constructor", e); }

Try / catch

try { app.start(); } catch (IllegalStateException e) { if (e.getMessage().startsWith("Unable to create global provider")) { log.error("Cause: ", e.getCause()); } else throw e; }

Prevention

When it happens

Trigger: The configured global provider class is not on the classpath, is abstract/an interface, has no public no-arg constructor, or its constructor throws — at Quarkus engine creation time.

Common situations: Class name typo; provider class lives in a dependency not shipped; no-arg constructor missing after refactoring; native image lacking reflection metadata for the class.

Related errors


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

Appendix: source

Thrown at extensions/qute/runtime/src/main/java/io/quarkus/qute/runtime/EngineProducer.java:383

            }
            throw new IllegalStateException("Not a resolver: " + resolverClassName);
        } catch (InstantiationException | IllegalAccessException | ClassNotFoundException | IllegalArgumentException
                | InvocationTargetException | NoSuchMethodException | SecurityException e) {
            throw new IllegalStateException("Unable to create resolver: " + resolverClassName, e);
        }
    }

    private TemplateGlobalProvider createGlobalProvider(String initializerClassName) {
        try {
            Class<?> initializerClazz = Thread.currentThread()
                    .getContextClassLoader().loadClass(initializerClassName);
            if (TemplateGlobalProvider.class.isAssignableFrom(initializerClazz)) {
                return (TemplateGlobalProvider) initializerClazz.getDeclaredConstructor().newInstance();
            }
            throw new IllegalStateException("Not a global provider: " + initializerClazz);
        } catch (InstantiationException | IllegalAccessException | ClassNotFoundException | IllegalArgumentException
                | InvocationTargetException | NoSuchMethodException | SecurityException e) {
            throw new IllegalStateException("Unable to create global provider: " + initializerClassName, e);
        }
    }

    private boolean isExcluded(String path) {
        for (Pattern p : templatePathExcludes) {
            if (p.matcher(path).matches()) {
                return true;
            }
        }
        return false;
    }

    private Optional<TemplateLocation> locate(String path) {
        if (isExcluded(path)) {
            return Optional.empty();
        }
        // First try the template contents, i.e. templates not backed by files
        LOGGER.debugf("Locate template contents for %s", path);

View on GitHub (pinned to e1c734241f)