Reputation: 83
I'm trying to get a very simple gwt-syncproxy example to work in Eclipse Developer Mode. I created the sample GWT/GAE project and named it "testgwtrpc". I verified that this works to send a greeting and receive the server's response. I created the following standalone Java program to invoke the 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);
}
});
}
I get the following exception thrown from 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
It looks like this should be simple, but, alas, it does not work.
Any ideas why? Help greatly appreciated.
Upvotes: 0
Views: 545
Reputation: 2051
I have two project, one has encountered this problem. That because SyncProxy cannot download following files from your site:
compilation-mappings.txt
*.nocache.js
*.cache.html
*.gwt.rpc
Upvotes: 0
Reputation: 83
The combined answers from @JCricket and @Ahmed El-Fayomy provided the information I needed to get this working. Many thanks to both of you. I decided to consolidate your answers so as to give a more complete and clear answer to the next person who has the same problem.
As said by JCricket, you must do a GWT compile, as gwt-syncproxy downloads several files from the App Engine application, including compilation-mappings.txt and the *.gwt.rpc file(s). The GWT compile generates these files. You will find, however, that the RPC call through gwt-syncproxy still fails unless you specify to app-engine to allow the *.gwt.rpc file(s) to be downloaded by the client. This is done as described in the link given by Ahmed here. Specifically, inside the "static-files" section of appengine-web.xml, change:
<exclude path="**.gwt.rpc" /> to <include path="**.gwt.rpc" />
One more thing:
When calling SyncProxy.setBaseURL() from your client application, I used the following URL:
http://127.0.0.1:8888/testgwtrpc/
where "testgwtrpc" is the module name, as renamed in my .gwt.xml file.
I have not yet tried this in production mode, only development mode.
Upvotes: 1
Reputation: 1329
Make sure you have performed a GWT-Compile (IE right click your testgwtrpc project, Google->GWT-Compile
). Testing within Eclipse and Dev Mode doesn't require these files because it's handled by GWT's hosted server system. But the Standalone and Android systems are separated and therefore require access to the files created by GWT-compiling.
Upvotes: 1
Reputation: 36
check this link
Unable to find RPC Policy File GWT-Compile your web-app, make sure your service is running where you expect it to be (deployed vs local testing urls), and if using GAE, make sure to alter your appengine-web.xml as noted in the Android#Setup_in_Eclipse section. Essentially, you need to make sure that the .gwt.rpc files are available to access from the "remote" Android client.
Upvotes: 1