3

With three friends, I am developing an application with gwt (2.6). A few weeks ago, we started to use super dev mode. Everything works great, except that two of us cant use ImageBundles. It started when I wanted to include a SuggestBox, which apparently loads some images. GWT compile failed. I googled a lot, and I couldn't fix it, so I started to work on something else: Loading some images using an ImageResourceBundle. GWT compile failed. Same error. Workaround: loading images not using ImageResourceBundle. Whats really strange is: two of us are working with windows, one with ubuntu and I'm using a mac. The compile works fine with ubuntu and with one of the windows machines. On the other machines, the compilation error stays always the same no matter what we try:

Compile with -strict or with -logLevel set to TRACE or DEBUG to see all errors.
   Computing all possible rebind results for 'com.google.gwt.user.client.ui.MenuBar.Resources'
      Rebinding com.google.gwt.user.client.ui.MenuBar.Resources
         Invoking generator com.google.gwt.resources.rebind.context.InlineClientBundleGenerator
            [ERROR] No @com.google.gwt.resources.ext.ResourceGeneratorType was specifed for type com.google.gwt.resources.client.ImageResource or its supertypes
   [ERROR] Errors in 'com/google/gwt/user/client/ui/MenuBar.java'
      [ERROR] Line 212: Failed to resolve 'com.google.gwt.user.client.ui.MenuBar.Resources' via deferred binding
   Computing all possible rebind results for 'com.google.gwt.user.client.ui.impl.ClippedImageImpl.Template'
      Rebinding com.google.gwt.user.client.ui.impl.ClippedImageImpl.Template
         Invoking generator com.google.gwt.safehtml.rebind.SafeHtmlTemplatesGenerator
            Constructing interface com.google.gwt.user.client.ui.impl.ClippedImageImpl.Template
               Generating method body for image()
                  [ERROR] Required annotation @Template not present on interface method public abstract com.google.gwt.safehtml.shared.SafeHtml image(com.google.gwt.safehtml.shared.SafeUri clearImage, com.google.gwt.safecss.shared.SafeStyles style)
   [ERROR] Errors in 'com/google/gwt/user/client/ui/impl/ClippedImageImpl.java'
      [ERROR] Line 104: Failed to resolve 'com.google.gwt.user.client.ui.impl.ClippedImageImpl.Template' via deferred binding
   Computing all possible rebind results for 'com.google.gwt.user.client.ui.impl.ClippedImageImpl.DraggableTemplate'
      Rebinding com.google.gwt.user.client.ui.impl.ClippedImageImpl.DraggableTemplate
         Invoking generator com.google.gwt.safehtml.rebind.SafeHtmlTemplatesGenerator
            Constructing interface com.google.gwt.user.client.ui.impl.ClippedImageImpl.DraggableTemplate
               Generating method body for image()
                  [ERROR] Required annotation @Template not present on interface method public abstract com.google.gwt.safehtml.shared.SafeHtml image(com.google.gwt.safehtml.shared.SafeUri clearImage, com.google.gwt.safecss.shared.SafeStyles style)
   [ERROR] Errors in 'com/google/gwt/user/client/ui/impl/ClippedImageImpl.java'
      [ERROR] Line 96: Failed to resolve 'com.google.gwt.user.client.ui.impl.ClippedImageImpl.DraggableTemplate' via deferred binding
[ERROR] Compiler returned false

I really don't know what to do. We checked nearly every setting/config-file in eclipse and tomcat. Its all the same. Has anyone an idea where to look? Maybe I'm looking in the wrong places. I appreciate any help you can give me.

Additional information (update):

  • When building the application with ant the gwt-compile runs without errors.
  • We use eclipse WITHOUT google plugins.
  • In dev mode the web application is started via tomcat7.
  • The super-dev-mode is invoked WITHIN the web application (in Servlet.init()). Therefor we had to add the gwt-dev jars into the classpath of the tomcat launcher.
  • Including new SuggestBox() anywhere into our gwt source code causes the gwt-compile-error on some machines. Without new SuggestBox() everything compiles everywhere.

I think it is a classpath or gwt-compile-sourcepath problem. But we see no differences on the different machines we use.

Witek
  • 6,160
  • 7
  • 43
  • 63
Sneaker182
  • 53
  • 1
  • 8

3 Answers3

3

As you have not included any code it is hard to guess what could have gone wrong, but here are some possible reasons:

Zero-parameter constructors

This is the one that was mentioned the most in the articles I read (references included below) and seems to create exactly the issue you are having, but I have to admit that I do not know why that would happen just to some of your teammates (maybe it is just needed under certain VMs or something like that).

It might be a deferred binding issue (according to the compiler log you posted) and therefore you should check if all your POJO (plain old java object) classes have a zero-parameter constructor for deferred loading.

Failed to resolve class via deferred binding

Conflicting annotations

Maybe you have some annotations placed wrong, as mentioned here:

Deferred binding failed GWT using uibinder

Some annotations such as @UiConstructor and @UiFactory don't go well together and (even though they are not actually conflicting in this case) can cause similar problems.

References & More

Community
  • 1
  • 1
flotothemoon
  • 1,882
  • 2
  • 20
  • 37
  • Thanks for your help, I have updated the original description with additional information. – Witek Jul 24 '14 at 11:24
  • @Witek Great, could you please include the code (atleast partially; constructor) of your SuggestBox class? – flotothemoon Jul 24 '14 at 11:28
  • It is the default com.google.gwt.user.client.ui.SuggestBox. Not our code. SuggestBox is only one example. It seams, we get the error when we use any GWT-component which itself uses images (or image bundles). – Witek Jul 24 '14 at 11:37
  • @Witek There are two different kinds of errors I see as an error source (the others are probably just some kind of stack-trace?) in the compiler log: 1.) No com.google.gwt.resources.ext.ResourceGeneratorType was specifed for type com.google.gwt.resources.client.ImageResource or its supertypes and 2.) Required annotation Template not present on interface method public abstract com.google.gwt.safehtml.shared.SafeHtml image(com.google.gwt.safehtml.shared.SafeUri clearImage, com.google.gwt.safecss.shared.SafeStyles style) So it might be an issue of missing annotations or something similar. – flotothemoon Jul 24 '14 at 11:49
3

When building the application with ant the gwt-compile runs without errors.

1) So if you compare the way you compile it and the way ant compiles it you will see the root cause.

2) In case you don't see any difference or you don't know how Eclipse (or whatever you use) compiles your application try to compile it in this way (we may call it true pure dzen way without any eclipse, ant, maven or other third-party "helpers"):

java -cp gwt-dev.jar;gwt-user.jar;validation-api-1.0.0.GA.jar;validation-api-1.0.0.GA-sources.jar;any/other/lib.jar;path/to/your/module/source/code com.google.gwt.dev.Compiler moduleName

In case your .gwt.xml descriptor is located under com/your/gwt/module/MyModule.gwt.xml you should use com.your.gwt.module.MyModule as a moduleName

Vadim
  • 1,125
  • 8
  • 18
  • Instead of running the code server in a separate thread in our web application, the web application now creates a new Java-Process which runs the CodeServer. – Witek Jul 30 '14 at 09:06
0

If you are using Maven, you can easily do a javac with mvn compile, then you can run mvn gwt:compile. These nasty errors will go away.

rjdamore
  • 308
  • 4
  • 12