quarkusio/quarkus · error · RuntimeException
RuntimeException(e)
Error message
RuntimeException(e)
What it means
QuarkusBackgroundFunction.setDelegates loads the configured BackgroundFunction delegate class by name and obtains it from CDI (Arc). If Class.forName fails to find the configured class, the ClassNotFoundException is wrapped in a RuntimeException. It means the configured delegate class is not on the runtime classpath.
Source
Thrown at extensions/google-cloud-functions/runtime/src/main/java/io/quarkus/gcp/functions/QuarkusBackgroundFunction.java:74
static void setDelegates(String selectedDelegate, String selectedRawDelegate) {
delegateClassLoader = Thread.currentThread().getContextClassLoader();
if (selectedDelegate != null) {
try {
Class<?> clazz = Class.forName(selectedDelegate, false, delegateClassLoader);
for (Method method : clazz.getDeclaredMethods()) {
if (method.getName().equals("accept")) {
// the first parameter of the accept method is the event, we need to register it's type to
// be able to deserialize to it to mimic what a BackgroundFunction does
Class<?>[] parameterTypes = method.getParameterTypes();
if (parameterTypes[0] != Object.class) {// FIXME we have two accept methods !!!
parameterType = parameterTypes[0];
}
}
}
delegate = (BackgroundFunction) Arc.container().instance(clazz).get();
} catch (ClassNotFoundException e) {
throw new RuntimeException(e);
}
}
if (selectedRawDelegate != null) {
try {
Class<?> clazz = Class.forName(selectedRawDelegate, false, delegateClassLoader);
rawDelegate = (RawBackgroundFunction) Arc.container().instance(clazz).get();
} catch (ClassNotFoundException e) {
throw new RuntimeException(e);
}
}
}
public static void clearState() {
delegate = null;
parameterType = null;
rawDelegate = null;
delegateClassLoader = null;View on GitHub (pinned to e1c734241f)
Solutions
- Check the wrapped ClassNotFoundException cause for the missing class name.
- Ensure the class name in quarkus.google-cloud-functions.function matches an existing function class (fully qualified name).
- Rebuild the application after adding/renaming function classes.
- Verify the function class is in the application archive, not an unindexed dependency.
Example fix
// before (application.properties) quarkus.google-cloud-functions.function=com.example.OldFunction // after quarkus.google-cloud-functions.function=com.example.MyFunction
Defensive patterns
Strategy: try-catch
Validate before calling
try { Class.forName("com.example.MyFunction"); } catch (ClassNotFoundException e) {
throw new IllegalStateException("Configured GCF function class missing: com.example.MyFunction");
} Try / catch
try { startFunction(); }
catch (RuntimeException e) {
if (e.getCause() instanceof ClassNotFoundException cnfe) {
log.error("Function class not found: " + cnfe.getMessage());
}
} Prevention
- Use fully qualified class names in quarkus.google-cloud-functions.function
- Rebuild after renaming function classes
- Keep function classes in the application archive, not optional deps
- Add a startup test that triggers delegate loading
When it happens
Trigger: The class name configured (via quarkus.google-cloud-functions.function / generated delegate selection) for the BackgroundFunction does not exist in delegateClassLoader at runtime.
Common situations: Renamed or deleted function class after build; wrong quarkus.google-cloud-functions.function value; class in a module not visible to the delegate classloader (classloading mismatch).
Related errors
- Expected : after attribute
- Unable to find or load top command: <className>
- Unable to find the following conversion class: ${customConve
- Unable to create resolver:
- Unable to create global provider:
AI-assisted analysis of quarkusio/quarkus@e1c734241f (2026-09-05).
Data as JSON: /api/errors/67ffe166ff9498d7.
Report an issue: GitHub.