Search code examples
gwtguicerequestfactory

RequestFactory javax.validation.ValidationException NoClassDefFoundError


I use Guice along with GWT 2.4 but I get a javax.validation.ValidationException NoClassDefFoundError when I run the server. In the pom.xml file I referenced the correct dependency:

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

but in Eclipse I can't see the validation-api-1.0.0.GA.jar in the Maven Dependencies tree. The behavior is pretty strange:

  • I can find validation-api-1.0.0.GA-sources.jar and javax.validation-validation-api-1.0.0.GA-sources.jar under the target directory. I don't understand why it's there.
  • In the Maven Dependencies tree of eclipse, I can see a reference to javax.validation-validation-api-1.0.0.GA-sources.jar which contains 5 packages but no classes.

Running the app outside eclipse works. I run it using mvn gwt:run.

Any ideas?


Solution

  • The problem came from the dependency gwt-user, I managed to fix it by excluding the dependency on validation-api:

        <dependency>
            <groupId>com.google.gwt</groupId>
            <artifactId>gwt-user</artifactId>
            <version>${gwt.version}</version>
            <scope>provided</scope>
            <exclusions>
                <exclusion>
                    <groupId>javax.validation</groupId>
                    <artifactId>validation-api</artifactId>
                </exclusion>
            </exclusions>
        </dependency>