apache/shenyu · error · ValidationException
<constraint violation messages joined by comma>
Error message
<constraint violation messages joined by comma>
What it means
ApacheDubboClientValidator runs Jakarta/Javax Bean Validation on a Dubbo service invocation's parameters. When any ConstraintViolation is found, it logs the failures and throws a Dubbo ValidationException whose message is all violation messages joined by commas. It is the client-side validation gate before a Dubbo call is dispatched.
Solutions
- Read the joined messages to identify which parameters violated which constraints and fix the caller's input
- Validate arguments with a Validator before making the Dubbo call
- Relax/adjust the validation annotations on the service DTO if the constraints are wrong
- Catch org.apache.dubbo.validation.ValidationException on the consumer side for graceful handling
Example fix
// before
userService.createUser(new UserDTO()); // missing name -> ValidationException
// after
Set<ConstraintViolation<UserDTO>> v = validator.validate(dto);
if (!v.isEmpty()) { dto.setName("required-name"); }
userService.createUser(dto); Defensive patterns
Strategy: validation
Validate before calling
Validator validator = Validation.buildDefaultValidatorFactory().getValidator();
Set<ConstraintViolation<Object>> violations = validator.validate(dto);
if (!violations.isEmpty()) {
throw new IllegalArgumentException(violations.stream()
.map(ConstraintViolation::getMessage).collect(Collectors.joining(",")));
} Try / catch
try { dubboService.call(arg); }
catch (ValidationException e) {
log.warn("Invalid arguments: {}", e.getMessage());
} Prevention
- Pre-validate DTOs with a local Validator before remote calls
- Keep validation annotations in sync with caller payloads
- Log full violation details server-side for debugging
When it happens
Trigger: Invoking a Dubbo service method (via consumer or during testValidate) whose annotated arguments fail @NotNull/@Size/@Pattern etc. constraints; the collected violations are non-empty after validator.validate().
Common situations: Callers passing null required fields, strings exceeding @Size limits, malformed values against @Pattern/@Email constraints; schema drift between client DTO validation annotations and caller data.
Understand the failure class
Background: Schema validation failed / invalid input schema: payload rejected because its shape doesn't match the expected schema — this error's family across 28 libraries.
Related errors
AI-assisted analysis of apache/shenyu@567142e072 (2026-09-12).
Data as JSON: /api/errors/6868b17b615c02fa.
Report an issue: GitHub.
Appendix: source
Thrown at shenyu-client/shenyu-client-dubbo/shenyu-client-apache-dubbo/src/main/java/org/apache/shenyu/client/apache/dubbo/validation/ApacheDubboClientValidator.java:288
// convert list to array
Class<?>[] classGroups = new Class<?>[groups.size()];
classGroups = groups.toArray(classGroups);
Object parameterBean = getMethodParameterBean(clazz, method, arguments);
if (Objects.nonNull(parameterBean)) {
violations.addAll(validator.validate(parameterBean, classGroups));
}
for (Object arg : arguments) {
validate(violations, arg, classGroups);
}
if (!violations.isEmpty()) {
LOG.error("Failed to validate service: {}, method: {}, cause: {}", clazz.getName(), methodName, violations);
StringBuilder validateError = new StringBuilder();
violations.forEach(each -> validateError.append(each.getMessage()).append(","));
throw new ValidationException(validateError.substring(0, validateError.length() - 1));
}
}
private void validate(final Set<ConstraintViolation<?>> violations, final Object arg, final Class<?>... groups) {
if (Objects.nonNull(arg) && !ReflectUtils.isPrimitives(arg.getClass())) {
if (arg instanceof Object[]) {
for (Object item : (Object[]) arg) {
validate(violations, item, groups);
}
} else if (arg instanceof Collection) {
for (Object item : (Collection<?>) arg) {
validate(violations, item, groups);
}
} else if (arg instanceof Map) {
for (Map.Entry<?, ?> entry : ((Map<?, ?>) arg).entrySet()) {
validate(violations, entry.getKey(), groups);
validate(violations, entry.getValue(), groups);
}View on GitHub (pinned to 567142e072)