This statement is dangerous:
AppController appViewer = new AppController(rpcService, eventBus, mItems);
because your code on the client side will be executed without witing for the response of your call.
Something like this should work:
public class MVPtest implements EntryPoint {
MenuItems mItems;
public void onModuleLoad() {
MainServiceAsync rpcService = GWT.create(MainService.class);
System.out.println("Inside of mod load. rpcService = " + rpcService.toString());
rpcService.getMenuItems(new AsyncCallback<MenuItems>() {
public void onFailure(Throwable caught) {
System.out.println("I failed...");
caught.printStackTrace();
}
public void onSuccess(MenuItems result) {
System.out.println("I got the menuitems.");
mItems = result;
HandlerManager eventBus = new HandlerManager(null);
AppController appViewer = new AppController(rpcService, eventBus, mItems);
appViewer.go(RootLayoutPanel.get());
}
});
}
}