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!
unfortunately, this doesn't work. With both jars, I get the same
error.
I also wonder why the dependencies-list (http://code.google.com/p/gwt-
validation/wiki/Dependencies) of gwt-validation doesn't mention any
validation framework like hibernate if it is really necessary. Doesn't
gwt-validation provide own client AND server side validators?
I have the following def in my project POM and it works fine
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-validator</artifactId>
<version>4.1.0.Final</version>
<exclusions>
<exclusion>
<groupId>javax.xml.bind</groupId>
<artifactId>jaxb-api</artifactId>
</exclusion>
<exclusion>
<groupId>com.sun.xml.bind</groupId>
<artifactId>jaxb-impl</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>javax.validation</groupId>
<artifactId>validation-api</artifactId>
<version>1.0.0.GA</version>
</dependency>
Thanks
Ashwin
After some debugging, I found out that in the class
com.em.validation.rebind.scan.ClassScanner ,
"this.reflections.getSubTypesOf(ConstraintValidator.class)" returns an
empty list (while it is filled in hosted mode). But I couldn't find
out why.
I tried to replace the gwt-validation-2.0-BETA-SNAPSHOT-r269.jar with
hibernate-validator-4.2.0.Final.jar in the final .war with the
following maven config:
<dependency>
<groupId>com.em</groupId>
<artifactId>gwt-validation</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-validator</artifactId>
<version>4.2.0.Final</version>
<scope>runtime</scope>
</dependency>
This worked in tomcat now, but made the hosted mode crash:
00:00:21,970 [ERROR] Line 1: The type org.joda.time.ReadableInstant
cannot be resolved. It is indirectly referenced from required .class
files
:-(
See: http://code.google.com/p/gwt-validation/issues/detail?id=52 for
more information.