13
// ...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);
3
  • You might have missed including the jar having com.gwt.client.MenuMaker in the build path for GWT Compiler. Also check com.gwt.client.*gwt.xml is in place ( not exlcuded by any filter ).
    – appbootup
    Dec 26, 2012 at 5:15
  • MenuMaker is my class. I don't know which libraries needed for deffered binding but in development mode all working. And what filter you talking about?
    – burtsevyg
    Dec 26, 2012 at 13:39
  • If using Maven .xml files should be placed in src/main/resources in same package (folder path) as your .java file. If using Ant, make sure to add .xml to your class path. If using Eclipse w/ m2e support, sometimes build path ignores .xml if it was placed in src/main/resources, ... modify build path of project via project's preferences. Dec 31, 2012 at 16:21

6 Answers 6

10

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.

6

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.

1

Check your model/ Pojo Class should implements Serializable

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

0

In my case, some of the model classes were not implementing com.google.gwt.user.client.rpc.IsSerializable, that's why I got the error mentioned in the question.

0

In my case, a key in Resource Bundle properties file which corresponds the method name was missing and the problem resolved after adding it.

0

Though this is pretty old thread, I am sharing my findings for this error as it took overnight for me to resolve.

For me the error was not using the final keyword on the referenced object in callback method. For below snippet, the reference object labelManager should be declared as final.

field.addValidator(new Validator<String>() {
   @Override
   public List<EditorError> validate(Editor<String> editor, String value) {
       String validationMsg = labelManager.validation_msg();
   }
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.