3 Replies Latest reply on Aug 14, 2013 5:32 PM by Christian Sadilek

    GWT validation - is it supported in Errai?

    Anton Hughes Master

      Hi

       

      I'm trying to use gwt validation, but am running into problems.

       

      Can anyone offer some guidence?

       

      My validator factory class is:

       

      package app.client.local;
      
      
      import app.client.shared.datamodel.Broker;
      
      
      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; 
      
      public class Validator extends AbstractGwtValidatorFactory { 
      
                 /**
                   * Validator marker for the Validation Sample project. Only the classes and groups listed
                   * in the {@link GwtValidation} annotation can be validated.
                   */
                  @GwtValidation(Broker.class)
                  public interface GwtValidator extends javax.validation.Validator {
                  }
      
      
                  @Override
                  public AbstractGwtValidator createValidator() {
                    return GWT.create(GwtValidator.class);
                  }
      
      
      }
      
      

       

      This is how I am attempting to use gwt validation:

       

       

      Validator validator = Validation.buildDefaultValidatorFactory().getValidator();
      Set<ConstraintViolation<Broker>> constraintViolations = validator.validate(b);
      
      

       

      But, alas, this error occurs:

       

                      00:10:14.771 [ERROR] Failed to create an instance of 'app.client.shared.datamodel._BrokerValidator' via deferred binding
      java.lang.NoClassDefFoundError: org/hibernate/validator/constraints/impl/NotNullValidator
           at app.client.shared.datamodel._BrokerValidatorImpl.<init>(_BrokerValidatorImpl.java:32)
           at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
           at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
           at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
           at java.lang.reflect.Constructor.newInstance(Constructor.java:526)
           at com.google.gwt.dev.shell.ModuleSpace.rebindAndCreate(ModuleSpace.java:465)
           at com.google.gwt.dev.shell.GWTBridgeImpl.create(GWTBridgeImpl.java:49)
           at com.google.gwt.core.client.GWT.create(GWT.java:97)
           at app.client.shared.datamodel._BrokerValidator.<clinit>(_BrokerValidator.java:6)
           at app.client.local.GwtValidatorImpl.validate(GwtValidatorImpl.java:24)
           at app.client.local.account.AddTraderAccount.onSaveClicked(AddTraderAccount.java:319)
           at org.jboss.errai.ioc.client.BootstrapperImpl$28$2$2.onClick(BootstrapperImpl.java:664)
           at com.google.gwt.event.dom.client.ClickEvent.dispatch(ClickEvent.java:54)
           at com.google.gwt.event.dom.client.ClickEvent.dispatch(ClickEvent.java:1)
           at com.google.gwt.event.shared.GwtEvent.dispatch(GwtEvent.java:1)
           at com.google.web.bindery.event.shared.EventBus.dispatchEvent(EventBus.java:40)
           at com.google.web.bindery.event.shared.SimpleEventBus.doFire(SimpleEventBus.java:193)
           at com.google.web.bindery.event.shared.SimpleEventBus.fireEvent(SimpleEventBus.java:88)
           at com.google.gwt.event.shared.HandlerManager.fireEvent(HandlerManager.java:127)
           at com.google.gwt.user.client.ui.Widget.fireEvent(Widget.java:129)
           at com.google.gwt.event.dom.client.DomEvent.fireNativeEvent(DomEvent.java:116)
           at com.google.gwt.user.client.ui.Widget.onBrowserEvent(Widget.java:177)
           at com.google.gwt.user.client.DOM.dispatchEventImpl(DOM.java:1351)
           at com.google.gwt.user.client.DOM.dispatchEvent(DOM.java:1307)
           at sun.reflect.GeneratedMethodAccessor145.invoke(Unknown Source)
           at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
           at java.lang.reflect.Method.invoke(Method.java:606)
           at com.google.gwt.dev.shell.MethodAdaptor.invoke(MethodAdaptor.java:103)
           at com.google.gwt.dev.shell.MethodDispatch.invoke(MethodDispatch.java:71)
           at com.google.gwt.dev.shell.OophmSessionHandler.invoke(OophmSessionHandler.java:172)
           at com.google.gwt.dev.shell.BrowserChannelServer.reactToMessagesWhileWaitingForReturn(BrowserChannelServer.java:337)
           at com.google.gwt.dev.shell.BrowserChannelServer.invokeJavascript(BrowserChannelServer.java:218)
           at com.google.gwt.dev.shell.ModuleSpaceOOPHM.doInvoke(ModuleSpaceOOPHM.java:136)
           at com.google.gwt.dev.shell.ModuleSpace.invokeNative(ModuleSpace.java:561)
           at com.google.gwt.dev.shell.ModuleSpace.invokeNativeObject(ModuleSpace.java:269)
           at com.google.gwt.dev.shell.JavaScriptHost.invokeNativeObject(JavaScriptHost.java:91)
           at com.google.gwt.core.client.impl.Impl.apply(Impl.java)
           at com.google.gwt.core.client.impl.Impl.entry0(Impl.java:213)
           at sun.reflect.GeneratedMethodAccessor135.invoke(Unknown Source)
           at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
           at java.lang.reflect.Method.invoke(Method.java:606)
           at com.google.gwt.dev.shell.MethodAdaptor.invoke(MethodAdaptor.java:103)
           at com.google.gwt.dev.shell.MethodDispatch.invoke(MethodDispatch.java:71)
           at com.google.gwt.dev.shell.OophmSessionHandler.invoke(OophmSessionHandler.java:172)
           at com.google.gwt.dev.shell.BrowserChannelServer.reactToMessages(BrowserChannelServer.java:292)
           at com.google.gwt.dev.shell.BrowserChannelServer.processConnection(BrowserChannelServer.java:546)
           at com.google.gwt.dev.shell.BrowserChannelServer.run(BrowserChannelServer.java:363)
           at java.lang.Thread.run(Thread.java:724)
      Caused by: java.lang.ClassNotFoundException: org.hibernate.validator.constraints.impl.NotNullValidator
           at com.google.gwt.dev.shell.CompilingClassLoader.findClass(CompilingClassLoader.java:1061)
           at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
           at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
           at app.client.shared.datamodel._BrokerValidatorImpl.<init>(_BrokerValidatorImpl.java:32)
           at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
           at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
           at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
           at java.lang.reflect.Constructor.newInstance(Constructor.java:526)
           at com.google.gwt.dev.shell.ModuleSpace.rebindAndCreate(ModuleSpace.java:465)
           at com.google.gwt.dev.shell.GWTBridgeImpl.create(GWTBridgeImpl.java:49)
           at com.google.gwt.core.client.GWT.create(GWT.java:97)
           at app.client.shared.datamodel._BrokerValidator.<clinit>(_BrokerValidator.java:6)
           at app.client.local.GwtValidatorImpl.validate(GwtValidatorImpl.java:24)
           at app.client.local.account.AddTraderAccount.onSaveClicked(AddTraderAccount.java:319)
           at org.jboss.errai.ioc.client.BootstrapperImpl$28$2$2.onClick(BootstrapperImpl.java:664)
           at com.google.gwt.event.dom.client.ClickEvent.dispatch(ClickEvent.java:54)
           at com.google.gwt.event.dom.client.ClickEvent.dispatch(ClickEvent.java:1)
           at com.google.gwt.event.shared.GwtEvent.dispatch(GwtEvent.java:1)
           at com.google.web.bindery.event.shared.EventBus.dispatchEvent(EventBus.java:40)
           at com.google.web.bindery.event.shared.SimpleEventBus.doFire(SimpleEventBus.java:193)
           at com.google.web.bindery.event.shared.SimpleEventBus.fireEvent(SimpleEventBus.java:88)
           at com.google.gwt.event.shared.HandlerManager.fireEvent(HandlerManager.java:127)
           at com.google.gwt.user.client.ui.Widget.fireEvent(Widget.java:129)
           at com.google.gwt.event.dom.client.DomEvent.fireNativeEvent(DomEvent.java:116)
           at com.google.gwt.user.client.ui.Widget.onBrowserEvent(Widget.java:177)
           at com.google.gwt.user.client.DOM.dispatchEventImpl(DOM.java:1351)
           at com.google.gwt.user.client.DOM.dispatchEvent(DOM.java:1307)
           at sun.reflect.GeneratedMethodAccessor145.invoke(Unknown Source)
           at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
           at java.lang.reflect.Method.invoke(Method.java:606)
           at com.google.gwt.dev.shell.MethodAdaptor.invoke(MethodAdaptor.java:103)
           at com.google.gwt.dev.shell.MethodDispatch.invoke(MethodDispatch.java:71)
           at com.google.gwt.dev.shell.OophmSessionHandler.invoke(OophmSessionHandler.java:172)
           at com.google.gwt.dev.shell.BrowserChannelServer.reactToMessagesWhileWaitingForReturn(BrowserChannelServer.java:337)
           at com.google.gwt.dev.shell.BrowserChannelServer.invokeJavascript(BrowserChannelServer.java:218)
           at com.google.gwt.dev.shell.ModuleSpaceOOPHM.doInvoke(ModuleSpaceOOPHM.java:136)
           at com.google.gwt.dev.shell.ModuleSpace.invokeNative(ModuleSpace.java:561)
           at com.google.gwt.dev.shell.ModuleSpace.invokeNativeObject(ModuleSpace.java:269)
           at com.google.gwt.dev.shell.JavaScriptHost.invokeNativeObject(JavaScriptHost.java:91)
           at com.google.gwt.core.client.impl.Impl.apply(Impl.java)
           at com.google.gwt.core.client.impl.Impl.entry0(Impl.java:213)
           at sun.reflect.GeneratedMethodAccessor135.invoke(Unknown Source)
           at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
           at java.lang.reflect.Method.invoke(Method.java:606)
           at com.google.gwt.dev.shell.MethodAdaptor.invoke(MethodAdaptor.java:103)
           at com.google.gwt.dev.shell.MethodDispatch.invoke(MethodDispatch.java:71)
           at com.google.gwt.dev.shell.OophmSessionHandler.invoke(OophmSessionHandler.java:172)
           at com.google.gwt.dev.shell.BrowserChannelServer.reactToMessages(BrowserChannelServer.java:292)
           at com.google.gwt.dev.shell.BrowserChannelServer.processConnection(BrowserChannelServer.java:546)
           at com.google.gwt.dev.shell.BrowserChannelServer.run(BrowserChannelServer.java:363)
           at java.lang.Thread.run(Thread.java:724)