我正在从事一个基于 ArcBees 提供的 CarStore 示例的 GWTP + GAE 项目。 Maven 依赖项也取自该项目。我当前的 GWTP 版本是 1.5-SNAPSHOT。
该项目编译得很好。但是当我运行它时,我陷入了这个错误:
[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>
该错误涉及 LoginPresenter 中声明的 ResourceDelegate。但我在我的代码中找不到任何错误。
我分析了堆栈跟踪并发现了这个原因:
[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)
这是指两个 Class 对象之间的调用。 DelegateGenerator 是调用者,并从此依赖项获取:
<dependency>
<groupId>com.gwtplatform.extensions</groupId>
<artifactId>dispatch-rest-delegates</artifactId>
<version>${gwtp.version}</version>
<scope>provided</scope>
</dependency>
而RegisterGinBindingEvent是接收者。它属于这里:
<dependency>
<groupId>com.gwtplatform</groupId>
<artifactId>gwtp-dispatch-rest</artifactId>
<version>${gwtp.version}</version>
<scope>provided</scope>
</dependency>
现在,这发生在 DelegateGenerator 的第 162 行:
RegisterGinBindingEvent.postSingleton(eventBus, definition, getClassDefinition());
这应该不是问题,但是 eventBus 作为第一个参数发送的键在两个类中具有不同的类型。
DelegateGenerator 有以下导入语句:
import com.google.common.eventbus.EventBus;
RegisterGinBindingEvent 有这个 EventBus 类:
import com.gwtplatform.dispatch.rest.rebind.utils.EventBus;
我猜这就是导致问题的原因。两个依赖项都使用相同的版本 (1.5-SNAPSHOT)。如果我将版本降级到 1.4,就不会发生这种情况。但使用此代码运行 ResourceDelegate 仍然存在问题。
有人知道我做错了什么吗?或者这是一个错误吗?
最佳答案
感谢您使用快照。
出于某种原因,CI 没有为上次提交部署快照。现在这个问题应该得到解决。你可以尝试另一个版本吗?将 -U 添加到您的 Maven 命令行以确保您获取最新的快照。
关于java - NoSuchMethodFound 错误 : dependency error in GWTP. ResourceDelegate 使用情况,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29662460/