Search code examples
gwterrai

Debugging with SuperDevMode


With SuperDevMode its very hard to debug GWT applications. My application compiles and runs fine. My app is using Errai, however accessing a Page throws this error:

SEVERE [AbstractCreationalContext] error initializing bean:

I wonder whether there's a solution for this, is there a way to pin point the error? I think its not enough just to "guess" what's wrong and make it work as it will be always be a chance to hit this error in the future.


Solution

  • Are you using Errai UI templating (i.e. @Templated)?

    If that is the case, check that you correctly map all the fields annotated as @Datafield in the composite object with the associated template as explained here.

    Errai error handling obfuscates the message for these kinds of errors. To be able to see the exact error you need to enable "Pause on caught exception" in your browser (as suggested by @El Hoss). The stacktrace will show you exactly which mapping is causing the error.


    Correct mapping

    CustomWidget.java

    @Templated
    class CustomWidget extends Composite {
       @DataField Label label = new Label();
    }
    

    CustomWidget.html

    <div>
      <div data-field="label"></div>
    </div>
    

    [Note] do not try to map the outer "div" element as a data-field as it is used to initialise your CustomWidget. I.e. executing this.getElement() in the CustomWidget will give you the wrapper object for the outer div element.