gwtgwt-validation

How to install gwt-validation with gwt-2.4.0


I would like to use Gwt-Validation with Gwt 2.4.0.

I have in my gwt.xml file :

  <inherits name="javax.validation.Validation" />
  <inherits name="com.google.gwt.validation.Validation" />
  <inherits name='com.em.validation.Validation' />

Like in the documentation, I have the following code :

import javax.validation.Validator;
import javax.validation.ValidatorFactory;
...

ValidatorFactory factory =
    Validation.byDefaultProvider().configure().buildValidatorFactory();

Validator validator = factory.getValidator();

The problem is that I have the following error :

Deferred binding result type 'javax.validation.ValidationFactory' should not be abstract.

//... beautiful stacktrace with mainly :

Deferred binding failed for 'javax.validation.ValidatorFactory' (did you forget to inherit a required module?)

My pom.xml contains :

<dependency>
  <groupId>com.googlecode.gwt-validation</groupId>
  <artifactId>gwt-validation</artifactId>
  <version>2.0</version>
</dependency>
<dependency>
  <groupId>javax.validation</groupId>
  <artifactId>validation-api</artifactId>
  <version>1.0.0.GA</version>
  <scope>provided</scope>
</dependency>
<dependency>
  <groupId>javax.validation</groupId>
  <artifactId>validation-api</artifactId>
  <version>1.0.0.GA</version>
  <classifier>sources</classifier>
  <scope>provided</scope>
</dependency>

What can I do ? Thanks.


Solution

  • The problem was in the java imports.

    In the following code :

    ValidatorFactory factory =
        Validation.byDefaultProvider().configure().buildValidatorFactory();
    Validator validator = factory.getValidator();
    

    I imported :

    com.google.gwt.validation.client instead of javax.validation

    No error at java compile time ! Just the errors above at gwt compile time (or runtime with the hosted mode).