Server side gwt-validation doesn't work (?)

109 views
Skip to first unread message

Nicolas.Rocca

unread,
Dec 7, 2011, 12:48:30 AM12/7/11
to gwt-validation, vsomm...@googlemail.com
We use gwt-validation-2.0-BETA-SNAPSHOT-r269.jar and GWT 2.4.

The field of the entity is annotated with
javax.validation.constraints.NotNull

Client side validation works and also server side validation in hosted
mode (jetty).

But when deployed in tomcat (6.0.20), we get the following exception
when server side validation is invoked:

Caused by: javax.validation.UnexpectedTypeException: No validator was
found for javax.validation.constraints.NotNull with type
[...deleted...]
at
com.em.validation.client.CoreValidatorImpl.validateConstraint(CoreValidatorImpl.java:
372)
at
com.em.validation.client.CoreValidatorImpl.validateValue(CoreValidatorImpl.java:
202)
at
com.em.validation.client.CoreValidatorImpl.validateProperty(CoreValidatorImpl.java:
119)
at
com.em.validation.client.CoreValidatorImpl.validate(CoreValidatorImpl.java:
76)
at
com.em.validation.client.CoreValidatorImpl.validate(CoreValidatorImpl.java:
96)
at com.em.validation.client.ValidatorImpl.validate(ValidatorImpl.java:
48)
at ...

Our war-file contains the gwt-validation-2.0-BETA-SNAPSHOT-r269.jar
and also the validation-api-1.0.0.GA.jar.

Replacing the gwt-validation-2.0-BETA-SNAPSHOT-r269.jar in the war
file with hibernate-validator-4.2.0.Final.jar seems to fix the problem
(as a workaround).

Thanks for help in advance!

Nicolas.Rocca

unread,
Dec 7, 2011, 10:38:18 AM12/7/11
to gwt-validation

chris.r

unread,
Dec 7, 2011, 1:28:48 PM12/7/11
to gwt-validation
The Reflections library that gwt-validation uses to mine the classpath
for information does not seem to work at all in a containerized
environment.
See: http://code.google.com/p/gwt-validation/issues/detail?id=52 for
more information.
On Dec 7, 10:38 am, "Nicolas.Rocca" <Nicolas.Ro...@t-online.de> wrote:
> See alsohttps://groups.google.com/group/google-web-toolkit/browse_thread/thre...

vsdev

unread,
Dec 8, 2011, 5:07:58 AM12/8/11
to gwt-validation
Chris, Why don't you use your implementation only for GWT compile and
Hibernate Validator in container for server-side validation (both
implement the JSR 303 - Bean Validation standard)?

chris.r

unread,
Dec 8, 2011, 10:07:33 AM12/8/11
to gwt-validation
People can certainly use it that way. It works just fine. (Some
people are.)

But this project is supposed to provide both services. I also find it
interesting to work on a JSR standard. If others don't want to use it
for that purpose then that's fine.

That *would* help in this case I think. I you should just be able to
drop in the Hibernate Validator jar.

Chris

chris.r

unread,
Jan 12, 2012, 3:39:27 PM1/12/12
to gwt-validation

Nicolas,

Have you tried with a newer version? I made some changes and I'm
going to keep updating it with some other changes. It might work for
you now. If not, please let me know. Thanks!

On Dec 7 2011, 12:48 am, "Nicolas.Rocca" <Nicolas.Ro...@t-online.de>
wrote:

Nicolas.Rocca

unread,
Feb 27, 2012, 5:31:40 AM2/27/12
to gwt-validation
The first validation still fails with version 2.0 snapshot r294 in
tomcat (see stacktrace below). Subsequent validations work correctly.

1462 [http-8081-2] ERROR org.reflections.Reflections - could not
create Vfs.Dir from url. ignoring the exception and continuing
org.reflections.ReflectionsException: could not create Dir using
org.reflections.vfs.Vfs$DefaultUrlTypes$1 from url file:/C:/Program
%20Files/Java/jdk1.6.0_21/jre/lib/ext/sunjce_provider.jar
at org.reflections.vfs.Vfs.fromURL(Vfs.java:98)
at org.reflections.vfs.Vfs.fromURL(Vfs.java:88)
at org.reflections.Reflections.scan(Reflections.java:199)
at org.reflections.Reflections.<init>(Reflections.java:91)
at
com.em.validation.rebind.scan.ClassScanner.scan(ClassScanner.java:160)
at
com.em.validation.rebind.scan.ClassScanner.<init>(ClassScanner.java:
99)
at
com.em.validation.rebind.scan.ClassScanner.<clinit>(ClassScanner.java:
59)
at
com.em.validation.rebind.resolve.ValidatorResolver.getValidatorClassesForAnnotation(ValidatorResolver.java:
74)
at
com.em.validation.rebind.resolve.ConstraintDescriptionResolver.getConstraintMetadata(ConstraintDescriptionResolver.java:
189)
at
com.em.validation.rebind.resolve.ConstraintDescriptionResolver.getConstraintsForProperty(ConstraintDescriptionResolver.java:
115)
at
com.em.validation.rebind.resolve.ConstraintDescriptionResolver.getConstraintDescriptors(ConstraintDescriptionResolver.java:
85)
at
com.em.validation.rebind.reflector.factory.RuntimeReflectorFactory.getReflector(RuntimeReflectorFactory.java:
59)
at
com.em.validation.client.reflector.ReflectorFactory.getReflector(ReflectorFactory.java:
40)
at
com.em.validation.client.ValidatorImpl.validate(ValidatorImpl.java:61)
at
com.zanox.gwt.showcase.server.rpc.ZxValidationActionHandler.validate(ZxValidationActionHandler.java:
40)

chris.r

unread,
Apr 9, 2012, 1:26:32 PM4/9/12
to gwt-val...@googlegroups.com
The newest snapshot for 2.1 (r324) should solve the problem with gwt-validation working on the server-side. 

Nicolas.Rocca

unread,
Jun 7, 2012, 8:25:54 AM6/7/12
to gwt-validation
Works now also server-side for us. Thanks!

chris.r

unread,
Jun 8, 2012, 3:06:28 PM6/8/12
to gwt-val...@googlegroups.com
Glad to hear that!
Reply all
Reply to author
Forward
0 new messages