Search code examples
javamavengoogle-app-enginegwtpgwt-platform

NoSuchMethodFound error: dependency error in GWTP. ResourceDelegate usage


I'm working in a GWTP + GAE project based on the CarStore example delviered by ArcBees. Maven dependencies are taken from that project too. My current version of GWTP is 1.5-SNAPSHOT.

The project compiles perfectly well. But when I run it, I'm stucked in this error:

[ERROR] Error injecting com.gwtplatform.dispatch.rest.delegates.client.ResourceDelegate<com.rmideas.sportbinder.shared.api.SessionResource>: 
Unable to create or inherit binding: No @Inject or default constructor found for com.gwtplatform.dispatch.rest.delegates.client.ResourceDelegate<com.rmideas.sportbinder.shared.api.SessionResource>

The error refers to the ResourceDelegate declared in LoginPresenter. But i can´t find anything wrong in my code.

I analyzed the stacktrace and found this cause:

[INFO] Caused by: java.lang.NoSuchMethodError: com.gwtplatform.dispatch.rest.rebind.events.RegisterGinBindingEvent.postSingleton(Lcom/google/common/eventbus/EventBus;Lcom/gwtplatform/dispatch/rest/rebind/utils/ClassDefinition;Lcom/gwtplatform/dispatch/rest/rebind/utils/ClassDefinition;)
[INFO]  at com.gwtplatform.dispatch.rest.delegates.rebind.DelegateGenerator.maybeRegisterGinBinding(DelegateGenerator.java:162)

This refers to a call between two Class objects. DelegateGenerator is the caller and is obtained from this dependency:

<dependency>
        <groupId>com.gwtplatform.extensions</groupId>
        <artifactId>dispatch-rest-delegates</artifactId>
        <version>${gwtp.version}</version>
        <scope>provided</scope>
    </dependency>

And RegisterGinBindingEvent is the receiver. It belongs to here:

<dependency>
        <groupId>com.gwtplatform</groupId>
        <artifactId>gwtp-dispatch-rest</artifactId>
        <version>${gwtp.version}</version>
        <scope>provided</scope>
    </dependency>

Now, this happens in line 162 of DelegateGenerator:

RegisterGinBindingEvent.postSingleton(eventBus, definition, getClassDefinition());

This shouldn't be a problem, but the key the eventBus sends as the first parameter is of a different type in both classes.

DelegateGenerator has this import statement:

import com.google.common.eventbus.EventBus;

And RegisterGinBindingEvent has this EventBus class:

import com.gwtplatform.dispatch.rest.rebind.utils.EventBus;

I guess that this is causing the problem. Both dependencies are using the same version (1.5-SNAPSHOT). If I downgrade the version to 1.4, this won´t happen. But it still has issues running ResourceDelegate with this code.

Does anyone know what am I be doing wrong? Or if this is a bug?


Solution

  • Thanks for using the snapshots.

    For some reason the CI didn't deploy a snapshot for the last commits. This should now be fixed. Can you try another build? Add -U to your maven command line to make sure you grab the latest snapshot.