Deferred binding failure in GWT

I am a total newbie to GWT/GAE framework. I was playing and modifying an objectify sample code myself last night and get into a “deferred binding failure” error. What I did is to add another entity class and extend classes PersistentService, PersistentServiceImp, and PersistentSerivceAsync to persist my data. I first ran the code as Web Application. OnModuleLoad threw an exception and gave me the following rather cryptic errors.

Java.lang.reflect.InvocationTargetException
 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
 at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
 at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
 at java.lang.reflect.Method.invoke(Method.java:616)
 at com.google.gwt.dev.shell.ModuleSpace.onLoad(ModuleSpace.java:396)
 at com.google.gwt.dev.shell.OophmSessionHandler.loadModule(OophmSessionHandler.java:183)
 at com.google.gwt.dev.shell.BrowserChannelServer.processConnection(BrowserChannelServer.java:510)
 at com.google.gwt.dev.shell.BrowserChannelServer.run(BrowserChannelServer.java:352)
 at java.lang.Thread.run(Thread.java:636)
Caused by: java.lang.RuntimeException: Deferred binding failed for 'com.example.myproject.client.PersistentService' (did you forget to inherit a required module?)
 at com.google.gwt.dev.shell.GWTBridgeImpl.create(GWTBridgeImpl.java:53)
 at com.google.gwt.core.client.GWT.create(GWT.java:97)
 at com.example.myproject.client.UserRequestUI.(UserRequestUI.java:31)
 at com.example.myproject.client.ObjectifyExample.onModuleLoad(ObjectifyExample.java:30)
 ... 9 more
Caused by: com.google.gwt.core.ext.UnableToCompleteException: (see previous log entries)
 at com.google.gwt.dev.shell.ModuleSpace.rebind(ModuleSpace.java:595)
 at com.google.gwt.dev.shell.ModuleSpace.rebindAndCreate(ModuleSpace.java:455)
 at com.google.gwt.dev.shell.GWTBridgeImpl.create(GWTBridgeImpl.java:49)
 ... 12 more

I dug into the web and it seems that there are zillions of ways getting into deferred binding failure. Since I just started yesterday, it took me long time to figure out that I should try compiling first instead. And I got some less obscure (a bit more informative) errors.

Compiling module com.example.myproject.ObjectifyExample
 [ERROR] Errors in 'file:/home/xxx/workspace/yyy/src/com/example/myproject/client/ObjectifyExample.java'
 [ERROR] Line 22:  Failed to resolve 'com.example.myproject.client.PersistentService' via deferred binding
 Scanning for additional dependencies: jar:file:/home/xxx/eclipse/plugins/com.google.gwt.eclipse.sdkbundle.2.1.1_2.1.1.v201012170127/gwt-2.1.1/gwt-user.jar!/com/google/gwt/core/client/impl/AsyncFragmentLoader.java
 [WARN] For the following type(s), generated source was never committed (did you forget to call commit()?)
 [WARN] com.example.myproject.client.PersistentService_Proxy
 [ERROR] Errors in 'file:/home/xxx/workspace/yyy/src/com/example/myproject/client/ProviderSearchUI.java'
 [ERROR] Line 27:  Failed to resolve 'com.example.myproject.client.PersistentService' via deferred binding
 Scanning for additional dependencies: file:/home/xxx/workspace/yyy/src/com/example/myproject/client/UserRequestUI.java
 [WARN] For the following type(s), generated source was never committed (did you forget to call commit()?)
 [WARN] com.example.myproject.client.PersistentService_Proxy
 [ERROR] Errors in 'file:/home/xxx/workspace/yyy/src/com/example/myproject/client/UserRequestUI.java'
 [ERROR] Line 31:  Rebind result 'com.example.myproject.client.PersistentService_Proxy' could not be found
 [ERROR] Cannot proceed due to previous errors

I was wondering if it was a config problem or if was jetty locking some files. It turns out that it was just a stupid mistake—I forgot to serialize the entity class!  After I added back “implements Serializable” to my entity class, everything works fine again. I guess these error messages can be really misleading.

Leave a Reply

Your email address will not be published. Required fields are marked *