{"record":{"id":"22c3b76069bf2a85","repo":"quarkusio/quarkus","slug":"could-not-load-exception-mapper","errorCode":null,"errorMessage":"Could not load exception mapper","messagePattern":"Could not load exception mapper","errorType":"exception","errorClass":"RuntimeException","httpStatus":null,"severity":"error","filePath":"independent-projects/resteasy-reactive/server/runtime/src/main/java/org/jboss/resteasy/reactive/server/core/RuntimeExceptionMapper.java","lineNumber":65,"sourceCode":"        mappers = new HashMap<>();\n        for (var i : mapping.effectiveMappers().entrySet()) {\n            mappers.put(loadThrowableClass(i.getKey(), classLoader), i.getValue());\n        }\n        blockingProblemPredicates = new ArrayList<>(mapping.blockingProblemPredicates);\n        nonBlockingProblemPredicate = new ArrayList<>(mapping.nonBlockingProblemPredicate);\n        unwrappedExceptions = new HashMap<>();\n        for (Map.Entry<String, ExceptionUnwrapStrategy> entry : mapping.getUnwrappedExceptions().entrySet()) {\n            Class<? extends Throwable> clazz = loadThrowableClass(entry.getKey(), classLoader);\n            ExceptionUnwrapStrategy strategy = entry.getValue();\n            unwrappedExceptions.put(clazz, strategy);\n        }\n    }\n\n    private static Class<? extends Throwable> loadThrowableClass(String className, ClassLoader classLoader) {\n        try {\n            return (Class<? extends Throwable>) Class.forName(className, false, classLoader);\n        } catch (ClassNotFoundException e) {\n            throw new RuntimeException(\"Could not load exception mapper\", e);\n        }\n    }\n\n    @SuppressWarnings({ \"unchecked\", \"rawtypes\" })\n    public void mapException(Throwable throwable, ResteasyReactiveRequestContext context) {\n        Class<?> klass = throwable.getClass();\n        //we don't read WebApplicationException's thrown from the client as true 'WebApplicationException'\n        //we consider it a security risk to transparently pass on the result to the calling server\n        boolean isWebApplicationException = throwable instanceof WebApplicationException\n                && !(throwable instanceof ResteasyReactiveClientProblem);\n        Response response = null;\n        if (isWebApplicationException) {\n            response = ((WebApplicationException) throwable).getResponse();\n        }\n        if (response != null && response.hasEntity()) {\n            context.setResult(response);\n            return;\n        }","sourceCodeStart":47,"sourceCodeEnd":83,"githubUrl":"https://github.com/quarkusio/quarkus/blob/e1c734241f34c7919086ceb4c9262b4a58f6de44/independent-projects/resteasy-reactive/server/runtime/src/main/java/org/jboss/resteasy/reactive/server/core/RuntimeExceptionMapper.java#L47-L83","documentation":"RuntimeExceptionMapper loads the throwable classes listed in quarkus.rest.mappers (configured custom exception mappers) by name via loadThrowableClass. If Class.forName cannot find the configured class in the given classloader, initialization fails with this RuntimeException wrapping the ClassNotFoundException.","triggerScenarios":"Configuring an exception mapper class name (e.g. quarkus.rest.* mapper config) that does not exist on the classpath at application start, so the mapper registry cannot be built.","commonSituations":"Typos in fully-qualified class names in configuration; renaming/moving a mapper class without updating config; mapper class in a dependency not packaged (optional/provided scope); class removed after a version upgrade.","solutions":["Fix the fully-qualified mapper class name in your configuration to match an existing @Provider ExceptionMapper class.","Ensure the class is on the runtime classpath (correct Maven/Gradle dependency scope, not excluded).","If the class was renamed or removed, update or delete the stale configuration entry.","Verify with `quarkus.log.category.\"...\".level=DEBUG` or a classpath check that the class is packaged in the artifact."],"exampleFix":"// application.properties before\nquarkus.rest.mappers.myMapper.class=com.example.OldMapper\n// after\nquarkus.rest.mappers.myMapper.class=com.example.NewExceptionMapper","handlingStrategy":"validation","validationCode":"static void assertMapperPresent(String className, ClassLoader cl) {\n    try { cl.loadClass(className); }\n    catch (ClassNotFoundException e) { throw new IllegalStateException(\"Configured mapper class not found: \" + className, e); }\n}","typeGuard":"boolean isConfiguredMapperLoadable(String fqcn, ClassLoader cl) {\n    try { return Throwable.class.isAssignableFrom(cl.loadClass(fqcn)); }\n    catch (ClassNotFoundException e) { return false; }\n}","tryCatchPattern":"try {\n    mapperRegistry.init();\n} catch (RuntimeException e) {\n    if (\"Could not load exception mapper\".equals(e.getMessage())) {\n        log.error(\"Check quarkus.rest mapper config class names and dependency scopes\", e.getCause());\n    }\n    throw e;\n}","preventionTips":["Verify fully-qualified mapper class names in configuration against actual packages.","Keep mapper classes in compile/runtime-scope dependencies.","Update configuration when renaming or moving ExceptionMapper classes.","Startup-validate configured class names in integration tests."],"tags":["quarkus","resteasy-reactive","exception-mapper","classpath","configuration"],"backgroundTag":"classnotfound","analyzedSha":"e1c734241f34c7919086ceb4c9262b4a58f6de44","analyzedAt":"2026-09-05T17:01:29.979Z","contentChangedAt":"2026-09-05T17:01:29.979Z","schemaVersion":2},"datasetVersion":"2026-09-12T22:17:10.623Z"}