I have the following problem:
12:45:47.505 [ERROR] [cGui] Error injecting com.gwtplatform.dispatch.rest.client.ActionMetadataProvider: Unable to create or inherit binding: No @Inject or default constructor found for com.gwtplatform.dispatch.rest.client.ActionMetadataProvider
Path to required node:
com.gwtplatform.dispatch.rest.client.RestRequestBuilderFactory [com.gwtplatform.dispatch.rest.client.gin.RestDispatchAsyncModule.configureDispatch(RestDispatchAsyncModule.java:100)]
->; com.gwtplatform.dispatch.rest.client.DefaultRestRequestBuilderFactory [com.gwtplatform.dispatch.rest.client.gin.RestDispatchAsyncModule.configureDispatch(RestDispatchAsyncModule.java:100)]
->; com.gwtplatform.dispatch.rest.client.ActionMetadataProvider [@Inject constructor of com.gwtplatform.dispatch.rest.client.DefaultRestRequestBuilderFactory]
My gwt.xml
<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE module PUBLIC "-//Google Inc.//DTD Google Web Toolkit 2.6.1//EN"
"https://raw.githubusercontent.com/gwtproject/gwt/2.6.1/distro-source/core/src/gwt-module.dtd">
<module rename-to="cGui">
<!-- Inherit the core Web Toolkit stuff. -->
<inherits name='com.google.gwt.user.User' />
<inherits name='com.google.gwt.inject.Inject' />
<!-- Default css -->
<inherits name='com.google.gwt.user.theme.standard.Standard' />
<!-- <inherits name='com.google.gwt.user.theme.chrome.Chrome'/> -->
<!-- <inherits name='com.google.gwt.user.theme.dark.Dark'/> -->
<!-- Other module inherits -->
<inherits name='com.gwtplatform.dispatch.Dispatch' />
<inherits name='com.gwtplatform.mvp.MvpWithEntryPoint' />
<!-- <inherits name="de.barop.gwt.PushState" /> -->
<inherits name='com.gwtplatform.dispatch.rest.DispatchRest' />
<inherits name="com.google.gwt.uibinder.GinUiBinder" />
<!-- <inherits name="com.gwtplatform.mvp.MvpWithFormFactor" /> -->
<inherits name="com.google.gwt.query.Query" />
<inherits name="com.google.common.collect.Collect" />
<!-- <inherits name="com.googlecode.objectify.Objectify" /> -->
<inherits name="com.gwtplatform.dispatch.rpc.DispatchRpc" />
<source path='client' />
<source path='shared' />
<set-configuration-property name="gin.ginjector.modules"
value="*CENSORED*.client.gin.ClientModule" />
</module>
ClientModule.java
public class ClientModule extends AbstractPresenterModule {
private static Logger logger = Logger.getLogger(ClientModule.class.getName());
@Override
protected void configure() {
logger.log(Level.INFO, "Installing Client Module dependencies");
install(new DefaultModule());
logger.log(Level.INFO, "DefaultModule installed");
install(new SecurityModule());
logger.log(Level.INFO, "SecurityModule installed");
install(new ApplicationModule());
logger.log(Level.INFO, "ApplicationModule installed");
install(new RestDispatchAsyncModule());
logger.log(Level.INFO, "RestDispatchAsyncModule installed");
install(new RpcDispatchAsyncModule());
logger.log(Level.INFO, "RpcDispatchAsyncModule installed");
// DefaultPlaceManager Places
bindConstant().annotatedWith(DefaultPlace.class).to(NameTokens.LOGIN);
bindConstant().annotatedWith(ErrorPlace.class).to(NameTokens.ERROR);
bindConstant().annotatedWith(UnauthorizedPlace.class).to(NameTokens.UNAUTHORIZED);
bindConstant().annotatedWith(RestApplicationPath.class).to("/rest");
}
}
The code is based on ArcBees carstore tag 1.3.1
My dependencies: pastebin.com
What have I tried:
I made sure every enum and DTO is serializable
Tried to fiddle around with gwt.xml
Googled a lot
I've been struggling with this for the past 5 hours.
If I have forgotten to attach some file, or did not give enough details please tell me. I will update this post accordingly.
In your gwt.xml,
DispatchRest
has to come beforeMvpWithEntryPoint
. You should read the important notes here as all the gotchas are explained: https://github.com/ArcBees/GWTP/wiki/Rest-Dispatch#add-rest-dispatch-to-your-gwt-moduleAlso
Dispatch
is a deprecated module, so you should useDispatchRpc
instead.