GWT using SDM throws error at app startup

Skip to first unread message


Aug 30, 2014, 1:37:09 PM8/30/14
I'm getting the following error after SDM compiles my app and trying to load it. What's causing this? Seems the compiler is generating invalid JS?  How can I resolve this?  I can't debug my app anymore.

SEVERE: (TypeError) __gwt$exception: <skipped>: Cannot read property 'view' of undefined (TypeError) __gwt$exception: <skipped>: Cannot read property 'view' of undefined: at 

I'm using GWT 2.6.1


Aug 30, 2014, 2:58:38 PM8/30/14
GWT often (if not always) transforms methods that are not overridden into static methods. Such static methods begin with a $ sign.

In your stack trace you can see Unknown.$getView is causing the exception with message "Can not read property 'view' of undefined". That basically means in your Java code you have called null.getView() because GWT transforms this into something like $getView(instance) { return instance.view; } with instance being "undefined" (= null).

So it is either a bug in your app which can cause NullPointer exceptions or you have found a very rare case which causes the GWT compiler to produce wrong JS. 

-- J.

David Hoffer

Aug 30, 2014, 6:28:32 PM8/30/14
to Google Web Toolkit
Hum...I'm not entirely clear how that maps to the java code.  As I follow that stack trace I think this comes down to this code:

public class LoadAdsPrepareGridPresenter {

    private final ILoadAdsPrepareGridModel model;
    private final ILoadAdsPrepareGridView view;

    public LoadAdsPrepareGridPresenter(final ILoadAdsPrepareGridModel model,
                                       final ILoadAdsPrepareGridView view) {
        this.model = model;
        this.view = view;

        model.addListener(new ILoadAdsPrepareGridModelListener() {
            public void gridRowsChanged() {

So are you saying that the member variable 'view' is null?  This is injected into the class so it's not possible for it to be null...and it's final.

Or are you saying that view is not null but it's somehow calling getView()?  I don't think this is the case but I wanted to be sure.  (In my java code the view doesn't have any method called 'getView()' I'm assuming 'getView()' is something generated by GWT to get the view variable.).


You received this message because you are subscribed to a topic in the Google Groups "Google Web Toolkit" group.
To unsubscribe from this topic, visit
To unsubscribe from this group and all its topics, send an email to
To post to this group, send email to
Visit this group at
For more options, visit


Aug 31, 2014, 5:43:35 AM8/31/14
The stack trace says the error is inside setBookingSheetRowData().

But just don't be afraid to look at the JS code. Open Chrome Dev Tools, go to the sources tab, open adloader-0.js (and wait a bit as it is maybe a large file), hit ctrl + g and enter the line numbers of the stack trace. For setBookingSheetRowData() it is line number 104761 and for $getView it is 31671. The JS code will look relatively similar to your Java code, as GWT does not do any optimizations.
Then you can set a breakpoint to see what is going on. You can also set a breakpoint on "java" level by going to the sources tab, hit ctrl + o to open provided by source maps and then set a breakpoint for view.setBookingSheetRowData(model.getGridBookingSheetRowModels());

-- J.

David Hoffer

Aug 31, 2014, 11:09:12 PM8/31/14
to Google Web Toolkit
My bad.  Somehow I almost convinced myself that GWT was wrapping my 'view' variable with a getter called getView that I didn't see what the stack trace was really telling me. (If I would have called my variable x this would have been obvious.)  Yes you are right there was a case where a widget that does have a getView method could be called at startup where the instance is null.  I have corrected this and all works well.  I had tried to load the JS file in notepad++ but it's so large it crashed the editor, thanks for the debugging tips & link to the Chrome shortcuts I will check this out as well. 


Reply all
Reply to author
0 new messages