Reputation: 35346
I have this working code in DevMode however when I run it in compiled code (live), its throwing an error in the Javascript browser console:
Code:
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) {
}
});
Error:
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)
How can I at the least debug this kind of issue?
Upvotes: 2
Views: 232
Reputation: 3502
For a start, compile the js in mode pretty. But if you don't know about GWT compiler details it might be hard to scan through the compiled code and guess from where the error comes.
It might be easier to do it the stupid way. Comment and deploy until you comment out and hence find the line that fails ! As I've no knowledge of the GWT compiler that's what I would do...
Upvotes: 0
Reputation: 639
As a start, you can compile to javascript in "pretty" mode which wouldn't produce obfuscated javascript. After that debugging the javascript in the browser is trivial.
With Mojo's Maven GWT Plugin this is done by the following line:
mvn gwt:compile -Dstyle=PRETTY
It seems to me however that this is something connected with configuration. Perhaps some kind of injection went bad or was not performed...
Upvotes: 2