我在 DevMode 中有这个工作代码,但是当我在编译代码(实时)中运行它时,它会在 Javascript 浏览器控制台中引发错误:
代码:
MyService service = GWT.create(MyService.class);
// This works
service.createStuff(title.getText(), content.getText(), new MethodCallback<MyModel>() {
@Override
public void onSuccess(Method method, MyModel resp) {
GWT.log("Response from server: " + resp);
}
@Override
public void onFailure(Method method, Throwable exception) {
GWT.log(exception.getMessage());
}
});
// This does not work
service.readStuff(id, new MethodCallback<MyModel>() {
@Override
public void onSuccess(Method method, MyModel model) {
}
@Override
public void onFailure(Method method, Throwable exception) {
}
});
错误:
com.google.gwt.core.client.JavaScriptException: (TypeError): Cannot call method 'ef' of null
at Unknown.nn(StackTraceCreator.java:168)
at Unknown.tl(StackTraceCreator.java:421)
at Unknown.SU(Exceptions.java:29)
at Unknown.Hjb(SubmittedPage.java:91)
at Unknown.qlb(AbstractRequestCallback.java:72)
at Unknown.Nu(Request.java:287)
at Unknown.qv(RequestBuilder.java:395)
at Unknown.anonymous(XMLHttpRequest.java:287)
at Unknown.Im(Impl.java:168)
at Unknown.Lm(Impl.java:214)
at Unknown.anonymous(Impl.java:57)
我怎样才能至少调试这种问题?