quarkusio/quarkus · error · java.lang.RuntimeException
No ${className}constructor found for params: ${parameterType
Error message
No ${className}constructor found for params: ${parameterTypes} What it means
Reflections.newInstance() first locates a declared constructor matching the requested parameter types; if none exists it throws this RuntimeException listing the class and the parameter types it searched for. Because the method is only used to instantiate beans, the missing constructor means the bean class does not expose the signature the container expects.
Source
Thrown at independent-projects/arc/runtime/src/main/java/io/quarkus/arc/impl/Reflections.java:148
constructor.setAccessible(true);
}
try {
return constructor.newInstance(args);
} catch (InvocationTargetException e) {
Throwable cause = e.getCause();
if (cause instanceof RuntimeException) {
throw (RuntimeException) cause;
}
if (cause instanceof Error) {
throw (Error) cause;
}
// this method is only used to instantiate beans, so throwing `CreationException` is fine
throw new CreationException(cause);
} catch (InstantiationException | IllegalAccessException | IllegalArgumentException e) {
throw new RuntimeException("Cannot invoke constructor: " + clazz.getName(), e);
}
}
throw new RuntimeException(
"No " + clazz.getName() + "constructor found for params: " + Arrays.toString(parameterTypes));
}
public static Object readField(Class<?> clazz, String name, Object instance) {
try {
Field field = clazz.getDeclaredField(name);
if (!field.canAccess(instance)) {
field.setAccessible(true);
}
return field.get(instance);
} catch (NoSuchFieldException | SecurityException | IllegalArgumentException | IllegalAccessException e) {
throw new RuntimeException("Cannot read field value: " + clazz.getName() + "#" + name, e);
}
}
public static void writeField(Class<?> clazz, String name, Object instance, Object value) {
try {
Field field = clazz.getDeclaredField(name);View on GitHub (pinned to e1c734241f)
Solutions
- Compare the requested parameter types with the actual constructor signatures of the class
- Regenerate/rebuild synthetic or generated bean code so it matches the current class signature
- Add a no-arg or matching constructor to the bean class
- Verify you pass the correct Class<?>[] (e.g. String.class, not Object.class)
Example fix
// before
Reflections.newInstance(Bean.class, new Class<?>[]{String.class}, new Object[]{42});
// after
Reflections.newInstance(Bean.class, new Class<?>[]{String.class}, new Object[]{"42"}); Defensive patterns
Strategy: validation
Validate before calling
boolean found = Arrays.stream(clazz.getDeclaredConstructors())
.anyMatch(c -> Arrays.equals(c.getParameterTypes(), parameterTypes));
if (!found) throw new IllegalArgumentException("No matching constructor on " + clazz); Try / catch
try { return Reflections.newInstance(clazz, types, args); }
catch (RuntimeException e) { log.error("Constructor lookup failed for " + clazz + " with " + Arrays.toString(types), e); throw e; } Prevention
- Rebuild generated/synthetic code after changing bean class constructors
- Keep a no-arg constructor on reflectively instantiated classes
- Pass exact Class literals, not Object.class placeholders
When it happens
Trigger: Calling Reflections.newInstance(clazz, parameterTypes, args) with parameterTypes that do not match any declared constructor of clazz (including after class redefinition or stale generated code).
Common situations: A generated/synthetic bean was rebuilt against an outdated bean class signature; a bean class constructor signature changed after a refactor; wrong Class[] passed manually when instantiating a class reflectively in an extension or test.
Related errors
- Cannot invoke constructor: ${className}
- Cannot read field value: ${className}#${name}
- Cannot set field value: ${className}#${name}
- Not an array type ${type}
- Unsupported injection point target: <injectionPoint>
AI-assisted analysis of quarkusio/quarkus@e1c734241f (2026-09-05).
Data as JSON: /api/errors/ac50b8d89ad91044.
Report an issue: GitHub.