[INFO] --- gwt-maven-plugin:2.9.0:compile (default) @ EasyPostWebApp ---
[INFO] Compiling module easypost.EasyPostWebApp
[INFO] Ignored 5 units with compilation errors in first pass.
[INFO] Compile with -strict or with -logLevel set to TRACE or DEBUG to see all errors.
[ERROR] WARNING: An illegal reflective access operation has occurred
[ERROR] WARNING: Illegal reflective access by com.google.inject.internal.cglib.core.$ReflectUtils$2 (file:/C:/Users/Businessman/.m2/repository/com/google/inject/guice/3.0/guice-3.0.jar) to method java.lang.ClassLoader.defineClass(java.lang.String,byte[],int,int,java.security.ProtectionDomain)
[ERROR] WARNING: Please consider reporting this to the maintainers of com.google.inject.internal.cglib.core.$ReflectUtils$2
[ERROR] WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
[ERROR] WARNING: All illegal access operations will be denied in a future release
[INFO] Computing all possible rebind results for 'com.gwtplatform.mvp.client.DesktopGinjector'
[INFO] Rebinding com.gwtplatform.mvp.client.DesktopGinjector
[INFO] Invoking generator com.google.gwt.inject.rebind.GinjectorGenerator
[INFO] [ERROR] Error injecting easypost.client.presenters.HomePresenter$MyProxy: Unable to create or inherit binding: No @Inject or default constructor found for easypost.client.presenters.HomePresenter$MyProxy
[INFO] Path to required node:
[INFO]
[INFO] easypost.client.presenters.HomePresenter$MyProxy [com.gwtplatform.mvp.client.gin.AbstractPresenterModule.bindPresenter(AbstractPresenterModule.java:121)]
[INFO]
[INFO] [ERROR] Error injecting easypost.client.views.HomeView$Binder: Unable to create or inherit binding: No @Inject or default constructor found for easypost.client.views.HomeView$Binder
[INFO] Path to required node:
[INFO]
[INFO] easypost.client.views.HomeView [com.gwtplatform.mvp.client.gin.AbstractPresenterModule.bindPresenter(AbstractPresenterModule.java:120)]
[INFO] -> easypost.client.views.HomeView$Binder [@Inject constructor of easypost.client.views.HomeView]
[INFO]
[INFO] [ERROR] Errors in 'gen/com/gwtplatform/mvp/client/DesktopGinjectorProvider.java'
[INFO] [ERROR] Line 8: Failed to resolve 'com.gwtplatform.mvp.client.DesktopGinjector' via deferred binding
以下是一些源代码:/ client /
EasyPostWebApp.gwt.xml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE module PUBLIC "-//Google Inc.//DTD Google Web Toolkit 2.9.0//EN"
"http://gwtproject.org/doctype/2.9.0/gwt-module.dtd">
<module rename-to='easypostwebapp'>
<inherits name='com.google.gwt.user.User'/>
<inherits name='com.google.gwt.user.theme.clean.Clean'/>
<inherits name = "com.google.gwt.uibinder.UiBinder"/>
<inherits name="com.gwtplatform.mvp.MvpWithEntryPoint"/>
<extend-configuration-property name="gin.ginjector.modules"
value="easypost.client.views.ClientModule"/>
<source path='client'/>
<source path='shared'/>
<set-configuration-property name="CssResource.enableGss" value="true"/>
<set-configuration-property name="CssResource.gssDefaultInUiBinder" value="true"/>
<!-- allow Super Dev Mode -->
<add-linker name="xsiframe"/>
</module>
/ client / views /HomeView.ui.xml
<ui:UiBinder xmlns:ui='urn:ui:com.google.gwt.uibinder'
xmlns:g='urn:import:com.google.gwt.user.client.ui'>
<ui:style>...</ui:style>
...
<g:HTMLPanel>
<div class="{style.address-container}">
<g:Button ui:field="createAddressButton">Create Address</g:Button>
<div class="{style.address-box}">
<g:HTML ui:field="serverResponse" />
</div>
</div>
</g:HTMLPanel>
</ui:UiBinder>
/ client / views /HomeView.java
public class HomeView extends ViewWithUiHandlers<HomeUiHandlers>
implements HomePresenter.MyView {
interface Binder extends UiBinder<HTMLPanel, HomeView> {}
@UiField Button createAddressButton;
@UiField HTML serverResponse;
@Inject
HomeView(Binder uiBinder) {
initWidget(uiBinder.createAndBindUi( this ));
createAddressButton.addClickHandler(clickEvent -> getUiHandlers().getServerResponse());
}
@Override
public void setServerResponse(String serverResponse) {
this.serverResponse.setHTML( serverResponse );
}
/ client / presenters /HomePresenter.java
public class HomePresenter extends Presenter<HomePresenter.MyView, HomePresenter.MyProxy>
implements HomeHandlers {
interface MyView extends View, HasUiHandlers<HomeUiHandlers> {
void setServerResponse(String serverResponse);
}
@ProxyStandard
@NameToken(NameTokens.HOME) // "/home"
interface MyProxy extends Proxy<HomePresenter> {}
private final EasyPostServiceAsync easyPostService;
@Inject
public HomePresenter(EventBus eventBus, HomePresenter.MyView view, HomePresenter.MyProxy proxy, EasyPostServiceAsync easyPostService) {
super(eventBus, view, proxy, ApplicationPresenter.SLOT_MAIN);
this.easyPostService = easyPostService;
getView().setUiHandlers(this);
}
@Override
public void getServerResponse() {
getView().setServerResponse("Waiting for response...");
easyPostService.helloFromServer(new AsyncCallback<>() {
@Override
public void onFailure(Throwable error) {
getView().setServerResponse("An error occured: " + error.getLocalizedMessage());
}
@Override
public void onSuccess(String response) {
getView().setServerResponse(response);
}
});
}
/ client / gin /HomeModule.java
public class HomeModule extends AbstractPresenterModule {
@Override
protected void configure() {
bindPresenter(HomePresenter.class, HomePresenter.MyView.class, HomeView.class,
HomePresenter.MyProxy.class);
}
}
/ shared / services /EasyPostService
@RemoteServiceRelativePath("easyPost")
public interface EasyPostService extends RemoteService {
String helloFromServer();
}
/ shared / services /EasyPostServiceAsync
public interface EasyPostServiceAsync {
void helloFromServer(AsyncCallback<String> callback);
}
/ server / servlet /EasyPostServiceImpl.java
public class EasyPostServiceImpl extends RemoteServiceServlet implements EasyPostService {
// sample method
@Override
public String helloFromServer() {
return "Hello, I am from server!";
}
}
Gin模块:
public class ClientModule extends AbstractPresenterModule { @Override protected void configure() { install(new DefaultModule.Builder() .tokenFormatter(RouteTokenFormatter.class) .defaultPlace(NameTokens.HOME) .errorPlace(NameTokens.HOME) .unauthorizedPlace(NameTokens.HOME) .build() ); install(new HomeModule()); bind(ResourceLoader.class).asEagerSingleton(); } }
是我做错了还是我对此很不好?任何帮助和提示,我们将不胜感激。谢谢!编辑:我简化了。如果我仅使用普通的自定义入口点并直接使用
GWT.create()
调用EasyPostServiceAsync,则RPC可以正常工作。但是我想通过gwtp和codeplitting实现这一目标。
我是gwt和gwtp的新手。我正在尝试制作一个可以连接和使用EasyPost API的简单应用程序。当我尝试运行代码时,它显示此错误。 [INFO] --- gwt-maven-plugin:2.9.0:compile ...
这似乎不是我们要传回的错误,但很乐意为您提供帮助。