quarkusio/quarkus · error · RuntimeException

Unable to load handled exception type ${i.getProvidedType()}

Error message

Unable to load handled exception type ${i.getProvidedType()}

What it means

Quarkus REST (RESTEasy Reactive) throws this during deployment while scanning context resolver providers. It failed to load the class named by the ContextResolver's handled type (the type parameter the resolver provides representations for) using the thread context classloader. This means the indexed type string cannot be resolved to a Class at deployment time.

Source

Thrown at extensions/resteasy-reactive/rest/deployment/src/main/java/io/quarkus/resteasy/reactive/server/deployment/ResteasyReactiveScanningProcessor.java:368

                }
            }
        }
        for (ContextResolverBuildItem i : additionalResolvers) {
            if (i.isRegisterAsBean()) {
                beanBuilder.addBeanClass(i.getClassName());
            } else {
                reflectiveClassBuildItemBuildProducer
                        .produce(ReflectiveClassBuildItem.builder(i.getClassName())
                                .build());
            }
            ResourceContextResolver resolver = new ResourceContextResolver();
            resolver.setClassName(i.getClassName());
            resolver.setMediaTypeStrings(i.getMediaTypes());
            try {
                resolvers.addContextResolver((Class) Class.forName(i.getProvidedType(), false,
                        Thread.currentThread().getContextClassLoader()), resolver);
            } catch (ClassNotFoundException e) {
                throw new RuntimeException(
                        "Unable to load handled exception type " + i.getProvidedType(), e);
            }
        }
        additionalBeanBuildItemBuildProducer.produce(beanBuilder.build());
        return new ContextResolversBuildItem(resolvers);
    }

    @BuildStep
    public void scanForParamConverters(CombinedIndexBuildItem combinedIndexBuildItem,
            ApplicationResultBuildItem applicationResultBuildItem,
            BuildProducer<ParamConverterBuildItem> paramConverterBuildItemBuildProducer) {
        IndexView index = combinedIndexBuildItem.getComputingIndex();
        Collection<ClassInfo> paramConverterProviders = index
                .getAllKnownImplementors(ResteasyReactiveDotNames.PARAM_CONVERTER_PROVIDER);

        for (ClassInfo converterClass : paramConverterProviders) {
            ApplicationScanningResult.KeepProviderResult keepProviderResult = applicationResultBuildItem.getResult()
                    .keepProvider(converterClass);

View on GitHub (pinned to e1c734241f)

Solutions

  1. Add the missing class/library as a dependency of the application so the TCCL can load the provided type
  2. Verify the ContextResolver's handled type generic parameter is correct and the class exists at compile time
  3. Check for typos or renamed/moved classes in the provider registration and rebuild with ./mvnw clean install
  4. If the type is optional, guard the resolver registration or exclude the provider from scanning

Example fix

// before (type not on classpath)
public class MyResolver implements ContextResolver<MyRemovedDto> { ... }
// after (restore or point to an existing type)
public class MyResolver implements ContextResolver<MyDto> { ... }
Defensive patterns

Strategy: validation

Validate before calling

// before registering, verify the handled type loads
try {
    Class.forName(providedTypeName, false, Thread.currentThread().getContextClassLoader());
} catch (ClassNotFoundException e) {
    throw new IllegalStateException("ContextResolver type missing from classpath: " + providedTypeName, e);
}

Try / catch

try { resolver.register(...) } catch (RuntimeException e) {
    if (e.getCause() instanceof ClassNotFoundException cnfe) {
        // handle missing provider type: log and skip or add dependency
    } else throw e;
}

Prevention

When it happens

Trigger: An application declares a jakarta.ws.rs.ext.ContextResolver whose handled type (e.g. a generic parameter or the value returned by a custom provider scan entry 'i.getProvidedType()') refers to a class that is not on the deployment classloader — e.g. an optional dependency not present, a typo in a synthetic provider entry, or the type lives in a module not visible to the TCCL.

Common situations: Using a ContextResolver for Jackson/JSON-B targeting a class from a library marked as optional; multi-module projects where the entity type is in a module not listed as a dependency; classloader changes after adding Quarkus REST; index entries recorded from a different classloader than the runtime one.

Related errors


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