hibernate-validator seems to be included twice with classifier=sources, rather than once with and once without.
Hi all,
I'm trying to mavenize my project that uses gwt 2.4.0 and hibernate-validator (+ Editors, RequestFactory, GIN if it makes any sense) for client-side validations. Non-mavenized project compiles and runs fine.
Mavenized project gives a set of simmilar errors (below) during gwt:compile that correspond to validation.
The reason obviously is in my POM but I can't figure out why. Significant POM parts are below.
Please help me! I'm stuck for 3 days already!
Thanks to all in advance!
Igory.
--- mvn gwt:compile output---
[INFO] Compiling module com.module.Module
[INFO] Validating newly compiled units
[INFO] Ignored 8 units with compilation errors in first pass.
[INFO] Compile with -strict or with -logLevel set to TRACE or DEBUG to see all errors.
[INFO] Resolving org.hibernate.validator.constraints.CreditCardNumber
[INFO] Found type 'org.hibernate.validator.constraints.CreditCardNumber'
[INFO] [ERROR] Annotation error: cannot resolve org.hibernate.validator.constraints.impl.CreditCardNumberValidator
[INFO] java.lang.ClassNotFoundException: org.hibernate.validator.constraints.impl.CreditCardNumberValidator
[INFO] at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
[INFO] at java.security.AccessController.doPrivileged(Native Method)
[INFO] at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
[INFO] at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
[INFO] at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
[INFO] at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
[INFO] at java.lang.Class.forName0(Native Method)
[INFO] at java.lang.Class.forName(Class.java:247)
...
[INFO] [ERROR] Annotation error: expected class java.lang.Class, got null
[INFO] Resolving org.hibernate.validator.constraints.Email
[INFO] Found type 'org.hibernate.validator.constraints.Email'
[INFO] [ERROR] Annotation error: cannot resolve org.hibernate.validator.constraints.impl.EmailValidator
[INFO] java.lang.ClassNotFoundException: org.hibernate.validator.constraints.impl.EmailValidator
[INFO] at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
[INFO] at java.security.AccessController.doPrivileged(Native Method)
[INFO] at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
[INFO] at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
[INFO] at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
[INFO] at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
[INFO] at java.lang.Class.forName0(Native Method)
[INFO] at java.lang.Class.forName(Class.java:247)
...
[INFO] [ERROR] Annotation error: expected class java.lang.Class, got null
[INFO] Resolving org.hibernate.validator.constraints.NotBlank
[INFO] Found type 'org.hibernate.validator.constraints.NotBlank'
[INFO] [ERROR] Annotation error: cannot resolve org.hibernate.validator.constraints.impl.NotBlankValidator
[INFO] java.lang.ClassNotFoundException: org.hibernate.validator.constraints.impl.NotBlankValidator
[INFO] at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
[INFO] at java.security.AccessController.doPrivileged(Native Method)
[INFO] at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
[INFO] at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
[INFO] at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
[INFO] at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
[INFO] at java.lang.Class.forName0(Native Method)
[INFO] at java.lang.Class.forName(Class.java:247)
...
[INFO] [ERROR] Annotation error: expected class java.lang.Class, got null
[INFO] Resolving org.hibernate.validator.constraints.ScriptAssert
[INFO] Found type 'org.hibernate.validator.constraints.ScriptAssert'
[INFO] [ERROR] Annotation error: cannot resolve org.hibernate.validator.constraints.impl.ScriptAssertValidator
[INFO] java.lang.ClassNotFoundException: org.hibernate.validator.constraints.impl.ScriptAssertValidator
[INFO] at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
[INFO] at java.security.AccessController.doPrivileged(Native Method)
[INFO] at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
[INFO] at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
[INFO] at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
[INFO] at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
[INFO] at java.lang.Class.forName0(Native Method)
[INFO] at java.lang.Class.forName(Class.java:247)
...
[INFO] [ERROR] Errors in 'file:/home/igory/workspace/com/module/client/validation/MyValidationFactory.java'
[INFO] [ERROR] Internal compiler error
[INFO] java.lang.ExceptionInInitializerError
[INFO] at com.google.gwt.validation.rebind.AbstractCreator.createBeanHelper(AbstractCreator.java:72)
[INFO] at com.google.gwt.validation.rebind.ValidatorCreator.<init>(ValidatorCreator.java:62)
[INFO] at com.google.gwt.validation.rebind.ValidatorGenerator.generate(ValidatorGenerator.java:68)
[INFO] at com.google.gwt.core.ext.GeneratorExtWrapper.generate(GeneratorExtWrapper.java:48)
[INFO] at com.google.gwt.core.ext.GeneratorExtWrapper.generateIncrementally(GeneratorExtWrapper.java:60)
[INFO] at com.google.gwt.dev.javac.StandardGeneratorContext.runGeneratorIncrementally(StandardGeneratorContext.java:647)
[INFO] at com.google.gwt.dev.cfg.RuleGenerateWith.realize(RuleGenerateWith.java:41)
[INFO] at com.google.gwt.dev.shell.StandardRebindOracle$Rebinder.rebind(StandardRebindOracle.java:78)
[INFO] at com.google.gwt.dev.shell.StandardRebindOracle.rebind(StandardRebindOracle.java:268)
[INFO] at com.google.gwt.dev.shell.StandardRebindOracle.rebind(StandardRebindOracle.java:257)
[INFO] at
com.google.gwt.dev.DistillerRebindPermutationOracle.getAllPossibleRebindAnswers(DistillerRebindPermutationOracle.java:91)
[INFO] at com.google.gwt.dev.jdt.WebModeCompilerFrontEnd.doFindAdditionalTypesUsingRebinds(WebModeCompilerFrontEnd.java:96)
[INFO] at com.google.gwt.dev.jdt.AbstractCompiler$Sandbox$CompilerImpl.process(AbstractCompiler.java:254)
[INFO] at org.eclipse.jdt.internal.compiler.Compiler.compile(Compiler.java:444)
[INFO] at com.google.gwt.dev.jdt.AbstractCompiler$Sandbox$CompilerImpl.compile(AbstractCompiler.java:173)
[INFO] at com.google.gwt.dev.jdt.AbstractCompiler$Sandbox$CompilerImpl.compile(AbstractCompiler.java:288)
[INFO] at com.google.gwt.dev.jdt.AbstractCompiler$Sandbox$CompilerImpl.access$400(AbstractCompiler.java:139)
[INFO] at com.google.gwt.dev.jdt.AbstractCompiler.compile(AbstractCompiler.java:588)
[INFO] at com.google.gwt.dev.jdt.BasicWebModeCompiler.getCompilationUnitDeclarations(BasicWebModeCompiler.java:97)
[INFO] at com.google.gwt.dev.jdt.WebModeCompilerFrontEnd.getCompilationUnitDeclarations(WebModeCompilerFrontEnd.java:52)
[INFO] at com.google.gwt.dev.jjs.JavaToJavaScriptCompiler.precompile(JavaToJavaScriptCompiler.java:569)
[INFO] at com.google.gwt.dev.jjs.JavaScriptCompiler.precompile(JavaScriptCompiler.java:33)
[INFO] at com.google.gwt.dev.Precompile.precompile(Precompile.java:284)
[INFO] at com.google.gwt.dev.Precompile.precompile(Precompile.java:233)
[INFO] at com.google.gwt.dev.Precompile.precompile(Precompile.java:145)
[INFO] at com.google.gwt.dev.Compiler.run(Compiler.java:232)
[INFO] at com.google.gwt.dev.Compiler.run(Compiler.java:198)
[INFO] at com.google.gwt.dev.Compiler$1.run(Compiler.java:170)
[INFO] at
com.google.gwt.dev.CompileTaskRunner.runWithAppropriateLogger(CompileTaskRunner.java:82)
[INFO] at com.google.gwt.dev.Compiler.main(Compiler.java:177)
[INFO] Caused by: javax.validation.ValidationException: Unable to get available provider resolvers.
[INFO] at javax.validation.Validation$GenericBootstrapImpl.configure(Validation.java:259)
[INFO] at javax.validation.Validation.buildDefaultValidatorFactory(Validation.java:111)
[INFO] at com.google.gwt.validation.rebind.BeanHelper.<clinit>(BeanHelper.java:61)
[INFO] ... 31 more
[INFO] Caused by: javax.validation.ValidationException: Unable to load Bean Validation provider org.hibernate.validator.HibernateValidator
[INFO] at javax.validation.Validation$DefaultValidationProviderResolver.getValidationProviders(Validation.java:349)
[INFO] at javax.validation.Validation$GenericBootstrapImpl.configure(Validation.java:256)
[INFO] ... 33 more
[INFO] Caused by: java.lang.ClassNotFoundException: org.hibernate.validator.HibernateValidator
[INFO] at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
[INFO] at java.security.AccessController.doPrivileged(Native Method)
...
And compilation fails due to Gin injector compilation with java.lang.ExceptionInInitializerError.
--- Significant POM sections: ---
<dependencies>
<!-- Hibernate-validator -->
<dependency>
<groupId>javax.validation</groupId>
<artifactId>validation-api</artifactId>
</dependency>
<dependency>
<groupId>javax.validation</groupId>
<artifactId>validation-api</artifactId>
<classifier>sources</classifier>
<!-- <scope>provided</scope> -->
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-validator</artifactId>
<version>4.2.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>
<classifier>sources</classifier>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-validator</artifactId>
<version>4.2.0.Final</version>
<classifier>sources</classifier>
<scope>provided</scope>
</dependency>
<!-- Use the JSR 330 injection interfaces -->
<dependency>
<groupId>javax.inject</groupId>
<artifactId>javax.inject</artifactId>
<version>1</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
<version>1.6.1</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>1.6.1</version>
</dependency>
<!-- GWT dependencies -->
<dependency>
<groupId>com.google.gwt</groupId>
<artifactId>gwt-servlet</artifactId>
<version>${gwt.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.google.gwt</groupId>
<artifactId>gwt-user</artifactId>
<version>${gwt.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.google.web.bindery</groupId>
<artifactId>requestfactory-server</artifactId>
<version>${gwt.version}</version>
</dependency>
--- Plugins configuration.
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<version>1.7</version>
<executions>
<execution>
<id>add-source</id>
<phase>generate-sources</phase>
<goals>
<goal>add-source</goal>
</goals>
<configuration>
<sources>
<source>${project.build.directory}/generated-sources/apt</source>
</sources>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>gwt-maven-plugin</artifactId>
<version>2.4.0</version>
<configuration>
<logLevel>INFO</logLevel>
<port>${gae.port}</port>
<compileTargets>
<value>com.module.Module</value>
</compileTargets>
<server>com.google.appengine.tools.development.gwt.AppEngineLauncher
</server>
<runTarget>/Module.jsp</runTarget>
<style>OBFUSCATED</style>
<webXml>war/WEB-INF/web.xml</webXml>
<gwtVersion>${gwt.version}</gwtVersion>
</configuration>
<executions>
<execution>
<phase>compile</phase>
<goals>
<goal>compile</goal>
</goals>
</execution>
</executions>
</plugin>