Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Failed to resolve class via deferred binding

// ...some imports

public class Menu {
    final MenuMaker myClass = GWT.create(MenuMaker.class);  // ERROR

My ...gwt.xml:

...
<generate-with class="com.gwt.rebind.MenuGenerator">
  <when-type-assignable class="com.gwt.client.MenuMaker" />
</generate-with>
...

All work perfectly when I run compile in DevMode but when I "Build the project with the GWT compiler" I get this error:

      [ERROR] Line 15:  Failed to resolve 'com.gwt.client.MenuMaker' via deferred binding
   Scanning for additional dependencies: jar:file:/C:/eclipse/plugins/com.google.gwt.eclipse.sdkbundle_2.4.0.v201208080121-rel-r42/gwt-2.4.0/gwt-user.jar!/com/google/gwt/dom/client/DOMImpl.java
      [WARN] For the following type(s), generated source was never committed (did you forget to call commit()?)
         [WARN] com.gwt.client.MenuMakerGen
   [ERROR] Cannot proceed due to previous errors

At the end of com.gwt.rebind.MenuGenerator:

sourceWriter.commit(logger);
like image 388
burtsevyg Avatar asked Dec 25 '12 19:12

burtsevyg


3 Answers

Check for gwt-compile problems. The message

[ERROR] Line 15:  Failed to resolve '...' via deferred binding

can result from compile problems in your gwt code. In my case it was a class, which was only available on the server side of the application, but was referenced in a class belonging to 'shared' part of the application.

In Java it compiled well, so I had no error in eclipse. The above error-message only showed up when building it with maven. Still it remained somewhat difficult to find the real problem, as the message text was not very helpful.

It turned out, that running the app on com.google.gwt.dev.DevMode would produce a more detailed logfile of the gwt-compilation (probably one could configure maven to do the same?). Right at the beginning of this more detailed log, there were entries, which pointed me to the problem described above. After correcting these problems, the "Failed to resolve ... via deferred binding"-error was gone.

like image 98
Jens Bühring Avatar answered Oct 17 '22 00:10

Jens Bühring


Check if all your client classes have default, zero-parameter constructor. I had the same "deferred binding" issue, and it turned out that one of my classes hadn't had default constructor. It was strange, because this class wasn't even mentioned in GWT compiler log.

like image 10
maciekb Avatar answered Oct 17 '22 00:10

maciekb


Check your model/ Pojo Class should implements Serializable

interface and also Class have default constructor(No argument constructor).

like image 1
MangduYogii Avatar answered Oct 17 '22 00:10

MangduYogii