Sunday, June 22, 2014

Re: Server side JSR 303 validation issues

Does your RPC declares ConstraintViolationException in its "throws" clause?

On Sunday, June 22, 2014 4:51:46 PM UTC+2, Arpit wrote:

I get following error on throwing ConstraintViolationException from following server code.

        Validator jsr303Validator = Validation.buildDefaultValidatorFactory().getValidator();
Set<ConstraintViolation<UserDto>> violations = jsr303Validator.validate(userDto);
if (!violations.isEmpty()) {
Set<ConstraintViolation<?>> violationSet = new HashSet<ConstraintViolation<?>>(violations);
throw new ConstraintViolationException(violationSet);
} Type 'java.util.HashSet' was not included in the set of types which can be serialized by this SerializationPolicy or its Class object could not be loaded. For security purposes, this type will not be serialized.: instance = [ConstraintViolationImpl{interpolatedMessage='Invalid user name.', propertyPath=name, rootBeanClass=class c.b.a.SomeClass, messageTemplate='Invalid user name.'}

HashSet can certainly be serialized as I can throw exception with HashSet<String> but throwing exception with HashSet<ConstraintViolation<?>> is not working! Any help is appreciated. I'm using GWT 2.5.1


You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To unsubscribe from this group and stop receiving emails from it, send an email to
To post to this group, send email to
Visit this group at
For more options, visit

No comments:

Post a Comment