我试图让一个非常简单的 gwt-syncproxy 示例在 Eclipse 开发人员模式下工作。我创建了示例 GWT/GAE 项目并将其命名为“testgwtrpc”。我验证这可以发送问候语并接收服务器的响应。我创建了以下独立 Java 程序来调用 GWT RPC。
SyncProxy.setBaseURL("http://127.0.0.1:8888/testgwtrpc/");
GreetingServiceAsync greetingServiceAsync = SyncProxy.create(GreetingService.class);
greetingServiceAsync.greetServer("Hello", new AsyncCallback<String>() {
@Override
public void onFailure(Throwable caught) {
}
@Override
public void onSuccess(String result) {
System.out.println("From server: " +result);
}
});
}
我收到以下异常SyncProxy.setBaseURL()
:
INFO: No RemoteService in the classpath
Feb 16, 2015 5:10:19 PM com.gdevelop.gwt.syncrpc.SyncProxy populatePolicyMap
INFO: Populating Policy Map
Exception in thread "main" com.gdevelop.gwt.syncrpc.exception.SyncProxyException: Error POLICY_NAME_POPULATION. Unable to populate policy names, see below exception.
at com.gdevelop.gwt.syncrpc.SyncProxy.populatePolicyMap(SyncProxy.java:515)
at com.gdevelop.gwt.syncrpc.SyncProxy.setBaseURL(SyncProxy.java:532)
at com.ptflix.utilities.CallGwtRpc.main(CallGwtRpc.java:12)
Caused by: java.io.FileNotFoundException: http://127.0.0.1:8888/testgwtrpc/compilation-mappings.txt
at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1835)
at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1440)
at com.gdevelop.gwt.syncrpc.RpcPolicyFinder.getResposeText(RpcPolicyFinder.java:201)
at com.gdevelop.gwt.syncrpc.RpcPolicyFinder.fetcherSerializationPolicyNameJS(RpcPolicyFinder.java:68)
at com.gdevelop.gwt.syncrpc.RpcPolicyFinder.fetchSerializationPolicyName(RpcPolicyFinder.java:180)
at com.gdevelop.gwt.syncrpc.SyncProxy.populatePolicyMap(SyncProxy.java:513)
... 2 more
看起来这应该很简单,但是,唉,它不起作用。
任何想法为什么?非常感谢帮助。