-->

Deferred binding failed

2019-02-19 09:32发布

问题:

My application is throwing:

java.lang.RuntimeException: Deferred binding failed for 'com.mygwtapp.client.gin.ClientAppGinjector' (did you forget to inherit a required module?)

on this code inside the EntryPoint:

private final ClientAppGinjector injector = GWT.create(ClientAppGinjector.class);

What could be the problem?

Here's the full error Log:

java.lang.RuntimeException: Deferred binding failed for 'com.mygwtapp.client.gin.ClientAppGinjector' (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.mygwtapp.client.MainEntryPoint.<init>(MainEntryPoint.java:79)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:525)
    at com.google.gwt.dev.shell.ModuleSpace.rebindAndCreate(ModuleSpace.java:465)
    at com.google.gwt.dev.shell.ModuleSpace.onLoad(ModuleSpace.java:375)
    at com.google.gwt.dev.shell.OophmSessionHandler.loadModule(OophmSessionHandler.java:200)
    at com.google.gwt.dev.shell.BrowserChannelServer.processConnection(BrowserChannelServer.java:525)
    at com.google.gwt.dev.shell.BrowserChannelServer.run(BrowserChannelServer.java:363)
    at java.lang.Thread.run(Thread.java:722)

回答1:

In your ".gwt.xml" file, add the following line:

<inherits name="com.google.gwt.inject.Inject"/>


回答2:

I've had the same error message during runtime. When I tried "Google > GWT Compile" the stack trace helped me better. My problem was that the service interface used a class that wasn't serializable.



回答3:

I had the same problem, I resolved lom adding the following libraries:

  • javax.inject.jar
  • guice-assistedinject-3.0.jar
  • aopalliance.jar


回答4:

I had the same problem. My getter method of Boolean object called getBooleanObject() instead of isBooleanObject(). Class JsonEncoderDecoder looked for method called isBooleanObject(), didn't find him, compilation failed. (gwt 2.8.0)