Deferred binding failure in GWT

January 2, 2011 at 3:15 pm 7 comments

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.

Entry filed under: About computer. Tags: , , , .

Annoying Opacify Feature in 10.10 Ubuntu share folders

7 Comments Add your own

  • 1. flez  |  March 10, 2011 at 2:06 pm

    be sure your client classes have default constructor.

    Reply
  • 2. Derek E  |  April 22, 2011 at 4:26 pm

    In this case, which class are you considering your entity class?

    Reply
  • 3. phsamuel  |  April 22, 2011 at 6:01 pm

    Derek, it depends on your application. But i put my entity classes inside com.example.myproject.client.entities as in the example. Just don’t forget to implement Serializable for them like I did.

    Reply
  • 4. Martin  |  August 5, 2011 at 7:00 am

    I have GWT service that is referring 15+ beans and one of them was missing Serializable declaration. I just got deferred error for the service proxy 8-Z. Thank you for the post – it saved me a lot of time ;)

    Reply
  • 5. churro  |  February 22, 2012 at 7:33 pm

    Thanks! I added implements Serializable to a bunch of classes, and it worked! You saved me a lot of time.

    Reply
  • 6. biku  |  August 10, 2012 at 9:04 pm

    Thank you; Ran into the same issue and your post helped me a lot!

    Reply
  • 7. ektor31  |  December 3, 2012 at 4:51 pm

    Thanks, I was stuck on the same problem…

    Reply

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Trackback this post  |  Subscribe to the comments via RSS Feed


Calendar

January 2011
M T W T F S S
« Dec   Feb »
 12
3456789
10111213141516
17181920212223
24252627282930
31  

Most Recent Posts


Follow

Get every new post delivered to your Inbox.

%d bloggers like this: