0

We have a gwt web application and now we are developing the android application for the same web application. In this we are trying to use the server side code of the web application and for that we are using SyncProxy (to connect android application with RPC).

My code is :

SyncProxy.setBaseURL("http://192.168.1.87/gwtandroidproject/");
        GreetingServiceAsync greetService = SyncProxy.create(GreetingService.class);
        CookieManager cm = ((HasProxySettings) greetService).getCookieManager();


        greetService.greetServer("123", new AsyncCallback<String>() {

            @Override
            public void onFailure(Throwable arg0) {
                // TODO Auto-generated method stub

            }

            @Override
            public void onSuccess(String arg0) {
                // TODO Auto-generated method stub
                Toast.makeText(mainActivity, arg0, 3000);
            }
        });

But exception is

09-03 15:45:52.628: E/AndroidRuntime(21080):
Caused by: com.gdevelop.gwt.syncrpc.exception.SyncProxyException: 
Error POLICY_NAME_POPULATION. Unable to populate policy names

NOTE: NO USE OF GAE IN THE APPLICATION

Piyush Srivastava
  • 357
  • 1
  • 4
  • 21

1 Answers1

1

Couple things to check (since you're not using App Engine, you may need to provide some details on your local server). Essentially, this error is advising you that the policy file's are not accessible.

  1. Typically this exception is thrown with a secondary exception. Look a little further down the stack trace to see if there is a secondary exception that was thrown to cause the SyncProxyException. If you're having problems getting the trace, catch this exception and wrap it in a newly thrown RuntimeException to get the full trace.
  2. Make sure your server was GWT-Compiled. Verifing that a GWT local interface is working is not enough, a full GWT-Compile must be available on the local server path.
  3. Make sure the path is accessible from the android device's browser ("http://192.168.1.87/gwtandroidproject/"). If not, make sure same network, same wifi, etc
  4. To get more detail, activate the GSP-Android's Logging feature. If you're 0.5, there are some details that are not yet logged properly (an upcoming 0.6 release will provide significantly better logging). To do so, perform the following: SyncProxy.setLoggingLevel(Level.FINER);. The 0.5 version has some issues with proper logging that have been addressed in 0.6, but this should still give you some information, specifically you want to get the "Accessing Permutation File: " log entry which will tell you which file is being accessed. As in the previous step, attempt to access this file directly through a browser: http://192.168.1.87/gwtandroidproject/PERM_FILE

Outside of these options, please provide some additional details on the local server you're using. I've only tested with a GAE local Dev server, but the principles should apply across the board...

JCricket
  • 1,318
  • 2
  • 17
  • 34
  • Thank you for the reply Info: SERVER : Apache Tomcat 8.0.15 / GWT 1.6 (what else u want to know plz tell) || the path is accessible from the android device's browser || Unable to understand what do mean by GWT-Compiled, we have compiled the gwt project and created war file and uploaded on local server – Piyush Srivastava Sep 04 '15 at 06:37
  • as you said i found further down one more exception : 09-04 13:19:13.894: E/AndroidRuntime(23042): Caused by: java.io.FileNotFoundException: http://192.168.1.87/gwtandroidproject/gwtandroidproject.nocache.js – Piyush Srivastava Sep 04 '15 at 07:58
  • So with the additional information you provided, I believe GSP will not work for you. GWT 1.6 is a much older version, and I don't believe the latest versions of GSP are able to parse out the services data from GWT 1.6 compilations. There is an older legacy version of GSP https://github.com/jcricket/gwt-syncproxy/releases/tag/gwt-syncproxy-0.3 that you could try, but it does not have an Android library (introduced in 0.4). The .nocache.js I believe was introduced in a more recent version of GWT (>2.5). – JCricket Sep 06 '15 at 03:04