title: GWT 2.4: "An internal compiler exception occurred" in project that uses Hibernate for Bean Validation
body: <p>It's been about 5 hrs since I decided to use JSR 303 Bean Validation in my GWT project and I gotta say I can't even express (politely) how deeply unsatisfied I am with <a href="http://code.google.com/p/google-web-toolkit/wiki/BeanValidation" rel="nofollow noreferrer">lame documentation</a> on the subject on Google's website.</p>
  
  <p>I really hope you guys can help me.</p>
  
  <p>I followed <a href="http://gglwebtoolkit.blogspot.com/2011/12/client-side-bean-validation-with-gwt.html" rel="nofollow noreferrer">this blog post</a> to add client-side bean validation to my project. Unfortunately it worked only once and threw an exception in runtime saying that I need to add Hibernate Validation sources to class path. I fixed that and decided to remassage my dependencies a little too (biggest mistake of my life) but I couldn't make it work ever again.</p>
  
  <p>I can't play with Validation sample from GWT SDK either because it's uncompilable because it has two implementations of class <code>ServerValidator</code>. Weird.</p>
  
  <p>So to simplify my question I created dummy GWT application using project wizard of IntelliJ IDEA. </p>
  
  <p>I added following elements to module xml:</p>
  
  <pre><code>&lt;inherits name="org.hibernate.validator.HibernateValidator"/&gt;
  &lt;replace-with class="com.mySampleApplication.client.ClientValidatorFactory"&gt;
      &lt;when-type-is class="javax.validation.ValidatorFactory"/&gt;
  &lt;/replace-with&gt;
  </code></pre>
  
  <p>Created <code>ClientValidatorFactory</code>:</p>
  
  <pre><code>package com.mySampleApplication.client;
  
  import com.google.gwt.core.client.GWT;
  import com.google.gwt.validation.client.AbstractGwtValidatorFactory;
  import com.google.gwt.validation.client.GwtValidation;
  import com.google.gwt.validation.client.impl.AbstractGwtValidator;
  
  import javax.validation.Validator;
  import javax.validation.groups.Default;
  
  public class ClientValidatorFactory extends AbstractGwtValidatorFactory
  {
      @GwtValidation(value = {Organization.class}, groups = {Default.class, ClientGroup.class})
      public interface GwtValidator extends Validator
      {
      }
  
      @Override
      public AbstractGwtValidator createValidator()
      {
          return GWT.create(GwtValidator.class);
      }
  }
  </code></pre>
  
  <p>And in <code>onModuleLoad()</code> method I added this single line which causes compiler to blow up</p>
  
  <pre><code>Validator validator = Validation.buildDefaultValidatorFactory().getValidator();
  </code></pre>
  
  <p>And finally I used following jars which I copied <strong>from Validation sample of GWT SDK</strong>.</p>
  
  <pre><code>hibernate-validator-4.1.0.Final-sources.jar
  hibernate-validator-4.1.0.Final.jar
  log4j-1.2.16.jar
  slf4j-api-1.6.1.jar
  slf4j-log4j12-1.6.1.jar
  validation-api-1.0.0.GA-sources.jar
  validation-api-1.0.0.GA.jar
  </code></pre>
  
  <p>But when I compile my project it gives following meaningless error:</p>
  
  <p><img src="https://i.stack.imgur.com/I7QlH.jpg" alt="enter image description here"></p>
  
  <p>In detailed GWT compiler log I see this:</p>
  
  <pre><code>Loaded 2315 units from persistent store.
     Found 2282 cached units.  Used 2282 / 2282 units from cache.
     Added 0 units to persistent cache.
     Validating newly compiled units
        Errors in 'jar:file:/C:/work/externals/gwt/gwt-user.jar!/org/hibernate/validator/engine/ConstraintViolationImpl_CustomFieldSerializer.java'
           Line 33: No source code is available for type org.hibernate.validator.engine.ConstraintViolationImpl&lt;T&gt;; did you forget to inherit a required module?
        Errors in 'jar:file:/C:/work/externals/gwt/gwt-user.jar!/org/hibernate/validator/engine/ValidationSupport.java'
           Line 43: No source code is available for type org.hibernate.validator.engine.ConstraintViolationImpl&lt;T&gt;; did you forget to inherit a required module?
        Errors in 'jar:file:/C:/work/externals/gwt/gwt-user.jar!/org/hibernate/validator/super/org/hibernate/validator/constraints/impl/EmailValidator.java'
           Line 25: No source code is available for type org.hibernate.validator.constraints.Email; did you forget to inherit a required module?
        Errors in 'jar:file:/C:/work/externals/gwt/gwt-user.jar!/org/hibernate/validator/super/org/hibernate/validator/constraints/impl/ScriptAssertValidator.java'
           Line 26: No source code is available for type org.hibernate.validator.constraints.Email; did you forget to inherit a required module?
        Errors in 'jar:file:/C:/work/externals/gwt/gwt-user.jar!/org/hibernate/validator/super/org/hibernate/validator/constraints/impl/URLValidator.java'
           Line 26: No source code is available for type org.hibernate.validator.constraints.URL; did you forget to inherit a required module?
        Errors in 'jar:file:/C:/work/externals/gwt/gwt-user.jar!/org/hibernate/validator/super/org/hibernate/validator/engine/PathImpl.java'
           Line 72: No source code is available for type org.hibernate.validator.engine.NodeImpl; did you forget to inherit a required module?
  </code></pre>
  
  <p>Why can't it find classses? I have <code>hibernate-validator-4.1.0.Final-sources.jar</code> in my classpath.</p>
  
  <p>Any thoughts ?</p>
  
  <p>I uploaded my project <strong><a href="http://www.box.com/s/gpvp2hmpxeajyryy5glo" rel="nofollow noreferrer">here</a></strong> if you guys want to play with it.</p>