quarkusio/quarkus · error · RuntimeException
Unable to determine if bean '${className}' is available
Error message
Unable to determine if bean '${className}' is available What it means
At runtime, a conditional-security (deny-unannotated / default check) supplier tries to reflectively load the bean class to ask Arc whether the bean is resolvable. If Class.forName cannot load the class name recorded at build time, it cannot decide availability and wraps the ClassNotFoundException in a RuntimeException.
Source
Thrown at extensions/resteasy-reactive/rest/runtime/src/main/java/io/quarkus/resteasy/reactive/server/runtime/ResteasyReactiveRecorder.java:378
}
// fail event rather than end it, so it's handled by abort handlers (see #addFailureHandler method)
event.put(QuarkusHttpUser.AUTH_FAILURE_HANDLER, new FailingDefaultAuthFailureHandler());
}
event.next();
}
};
}
public Supplier<Boolean> beanUnavailable(String className) {
return new Supplier<>() {
@Override
public Boolean get() {
try {
return !Arc.container().select(Class.forName(className, false, Thread.currentThread()
.getContextClassLoader())).isResolvable();
} catch (ClassNotFoundException e) {
throw new RuntimeException("Unable to determine if bean '" + className + "' is available", e);
}
}
};
}
private List<RouteDescription> fromClassMappers(String applicationPath,
List<RequestMapper.RequestPath<RestInitialHandler.InitialMatch>> classMappers) {
Map<String, RouteDescription> descriptions = new HashMap<>();
RuntimeResourceVisitor.visitRuntimeResources(applicationPath, classMappers, new RuntimeResourceVisitor() {
private RouteDescription description;
@Override
public void visitRuntimeResource(String httpMethod, String fullPath, RuntimeResource runtimeResource) {
ServerMediaType serverMediaType = runtimeResource.getProduces();
List<MediaType> produces = Collections.emptyList();
if (serverMediaType != null) {
if ((serverMediaType.getSortedOriginalMediaTypes() != null)View on GitHub (pinned to e1c734241f)
Solutions
- Rebuild the application cleanly (./mvnw clean install) so recorded class names match the code
- Fix the package/name refactor so the resource class exists at the recorded name
- Ensure the class is in a module visible to the application classloader, not an optional/unloaded layer
- If using dev mode, restart dev mode to refresh the runtime configuration suppliers
Defensive patterns
Strategy: try-catch
Validate before calling
// verify the class is loadable before enabling deny-unannotated endpoints
try {
Class.forName(resourceClassName, false, Thread.currentThread().getContextClassLoader());
} catch (ClassNotFoundException e) {
// resource class not on runtime classpath — rebuild the app
} Try / catch
try {
boolean resolvable = availabilitySupplier.get();
} catch (RuntimeException e) {
if (e.getCause() instanceof ClassNotFoundException) {
// stale build: trigger clean rebuild / restart dev mode
} else throw e;
} Prevention
- Clean rebuild after renaming or removing resource classes
- Keep quarkus.security.jaxrs.deny-unannotated-endpoints config consistent with existing classes
- Avoid classloader isolation mismatches between app modules
When it happens
Trigger: quarkus.security.jaxrs.deny-unannotated-endpoints / default-roles-allowed is enabled and a recorded resource class name cannot be loaded by the thread context classloader at runtime — typically because the class was removed/renamed after build, or a class in a non-visible module/classloader was indexed.
Common situations: Hot reload / stale build artifacts referencing removed classes; classloader isolation between the app and platform layers; running with an outdated application build after refactoring package names.
Related errors
- Security annotation placed on resource method '${className}#
- Unable to load handled exception type ${i.getProvidedType()}
- HTTP Security policy applied only on Quarkus REST cannot be
- @AuthorizationPolicy annotation placed on resource method '$
- Registering default SecurityCheck that requires secured meth
AI-assisted analysis of quarkusio/quarkus@e1c734241f (2026-09-05).
Data as JSON: /api/errors/7704121834ec6db0.
Report an issue: GitHub.