JBoss.orgCommunity Documentation

Chapter 14. Troubleshooting & FAQ

14.1. Why does it seem that Errai can't see my class at compile time?
14.2. Why am I getting "java.lang.ClassFormatError: Illegal method name "<init>$" in class org/xyz/package/MyClass"?
14.3. I'm getting "java.lang.RuntimeException: There are no proxy providers registered yet." in my @PostConstruct method!

This section explains the cause of and solution to some common problems that people encounter when building applications with Errai.

Of course, when lots of people trip over the same problem, it's probably because there is a deficiency in the framework! A FAQ list like this is just a band-aid solution. If you have suggestions for permanent fixes to these problems, please get in touch with us: file an issue in our issue tracker, chat with us on IRC, or post a suggestion on our forum.

But for now, on to the FAQ:

Possible symptoms:

Answer: Make sure the Section 12.3, “ErraiApp.properties” file is actually making it into your runtime classpath.

One common cause of this problem is a <resources> section in pom.xml that includes src/main/java (to expose .java sources to the GWT compiler) that does not also include src/main/resources as a resource path. You must include both explicitly:



<resources>
  <resource>
    <directory>src/main/java</directory>
  </resource>
  <resource>
    <directory>src/main/resources</directory>
  </resource>
</resources>

Answer: This error message means that your project has a (direct or indirect) subclass of JavaScriptObject that lacks a protected no-args constructor. All subtypes of JavaScriptObject (also known as overlay types ) must declare a protected no-args constructor, but the error message could be much clearer. There is an issue filed in the GWT project's bug tracker for improving the error message: GWT issue 3383 .

Answer: You can't invoke RPC methods via Caller<?> or by other means until after the Errai Bus has finished its initial handshake. Try changing your @PostConstruct annotation to @AfterInitialization . This will cause your method to be invoked later—after the bus handshake has completed.

If this doesn't help, it is also possible that the proxies were never generated in the first place. Check in .errai/RpcProxyLoaderImpl.java to see if proxy code exists for the @Remote and/or @Path interface in question. If not, your @Remote interfaces were not present on the GWT compiler's classpath when your application module was compiled. Double-check your GWT compilation classpath: all @Remote interfaces must be visible to (in or inherited by) the GWT module that contains the Caller<?> types. Pay special attention that your @Remote and @Path interfaces are not in a package excluded from the GWT module (by default, every subpackage other than client and shared is invisible to the GWT compiler).