Android上的Azure MobileServicePushFailedException

Android上的Azure MobileServicePushFailedException,android,azure,azure-mobile-services,Android,Azure,Azure Mobile Services,我正在尝试使用离线同步构建一个应用程序,并遵循 现在,脱机存储工作正常,但服务器上没有添加任何项目,但以下情况除外: Error syncAsync com.microsoft.windowsazure.mobileservices.table.sync.push.MobileServicePushFailedException java.util.concurrent.ExecutionException: com.microsoft.windowsazure.mobilese

我正在尝试使用
离线同步构建一个应用程序,并遵循

现在,
脱机存储
工作正常,但服务器上没有添加任何项目,但以下情况除外:

       Error syncAsync com.microsoft.windowsazure.mobileservices.table.sync.push.MobileServicePushFailedException
 java.util.concurrent.ExecutionException: com.microsoft.windowsazure.mobileservices.table.sync.push.MobileServicePushFailedException
     at com.google.common.util.concurrent.AbstractFuture$Sync.getValue(AbstractFuture.java:299)
     at com.google.common.util.concurrent.AbstractFuture$Sync.get(AbstractFuture.java:286)
     at com.google.common.util.concurrent.AbstractFuture.get(AbstractFuture.java:116)
     at irisrecognition.example.com.irisrecognition.util.ItemManager$5.doInBackground(ItemManager.java:237)
     at irisrecognition.example.com.irisrecognition.util.ItemManager$5.doInBackground(ItemManager.java:232)
     at android.os.AsyncTask$2.call(AsyncTask.java:288)
     at java.util.concurrent.FutureTask.run(FutureTask.java:237)
     at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:231)
     at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
     at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
     at java.lang.Thread.run(Thread.java:818)
 Caused by: com.microsoft.windowsazure.mobileservices.table.sync.push.MobileServicePushFailedException
     at com.microsoft.windowsazure.mobileservices.table.sync.MobileServiceSyncContext.pushOperations(MobileServiceSyncContext.java:939)
     at com.microsoft.windowsazure.mobileservices.table.sync.MobileServiceSyncContext.consumePushSR(MobileServiceSyncContext.java:834)
     at com.microsoft.windowsazure.mobileservices.table.sync.MobileServiceSyncContext.access$1100(MobileServiceSyncContext.java:85)
     at com.microsoft.windowsazure.mobileservices.table.sync.MobileServiceSyncContext$PushSyncRequestConsumer.run(MobileServiceSyncContext.java:1127)
以下是
onCreate()

还有一些

private AsyncTask<Void, Void, Void> initLocalStore() throws MobileServiceLocalStoreException, ExecutionException, InterruptedException {

        AsyncTask<Void, Void, Void> task = new AsyncTask<Void, Void, Void>() {
            @Override
            protected Void doInBackground(Void... params) {
                try {
                    mPullQuery = mClient.getTable(IrisEntry.class).where().orderBy("__createdAt", QueryOrder.Descending);

                    MobileServiceSyncContext syncContext = mClient.getSyncContext();
                    SQLiteLocalStore localStore = new SQLiteLocalStore(mClient.getContext(), "OfflineStore", null, 1);
                    SimpleSyncHandler handler = new SimpleSyncHandler();

                    Map<String, ColumnDataType> tableDefinition = new HashMap<String, ColumnDataType>();
                    tableDefinition.put("id", ColumnDataType.String);
                    tableDefinition.put("text", ColumnDataType.String);
                    tableDefinition.put("device", ColumnDataType.String);
                    tableDefinition.put("segmentationAlgo", ColumnDataType.String);
                    tableDefinition.put("imageUri", ColumnDataType.String);
                    tableDefinition.put("containerName", ColumnDataType.String);
                    tableDefinition.put("resourceName", ColumnDataType.String);
                    tableDefinition.put("sasQueryString", ColumnDataType.String);
                    tableDefinition.put("userId", ColumnDataType.String);
                    tableDefinition.put("complete", ColumnDataType.Boolean);

                    localStore.defineTable(Constants.TABLE_IRIS, tableDefinition);
                    syncContext.initialize(localStore, handler).get();

                    mIrisTable = mClient.getSyncTable(IrisEntry.class);
                } catch (final Exception e) {
                    e.printStackTrace();
                }

                return null;
            }
        };

        return runAsyncTask(task);
    }


 public void syncAsync() {
        if (isNetworkAvailable()) {
            new AsyncTask<Void, Void, Void>() {

                @Override
                protected Void doInBackground(Void... params) {
                    try {
                        mClient.getSyncContext().push().get();
                        mIrisTable.pull(mPullQuery).get();
                        Log.e(LOGTAG, "Success syncAsync");

                    } catch (Exception e) {
                        Log.e(LOGTAG, "Error syncAsync " + e.getMessage());
                        e.printStackTrace();

                    }
                    return null;
                }
            }.execute();
        } else {
            Log.e(LOGTAG, "You are not online, re-sync later!");
        }
    }

    private boolean isNetworkAvailable() {
        ConnectivityManager connectivityManager
                = (ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE);
        NetworkInfo activeNetworkInfo = connectivityManager.getActiveNetworkInfo();
        return activeNetworkInfo != null && activeNetworkInfo.isConnected();
    }

我不确定这是否是答案,但“Constants.ROOT_URL”是否包含类似“”的协议头字符串?ENOTFOUND错误意味着无法解析getaddrinfo调用的地址。您可能希望尝试“myurl.com”,而不使用URI的协议部分。该方法还需要参数的类类型Uri。看起来您可能正在从MalformedUrieException处理程序获取堆栈跟踪。(即使您指定了其他内容,调用也可能使用https)。

据我所知,问题是我的表被设置为
anonmyos Access
。我将它们设置为“仅验证”
,同步再次正常工作。无论如何,我希望在没有身份验证的情况下访问一些表(由所有用户读取),并检查我是否能够以某种方式修复此问题

使用Fiddler发布堆栈跟踪调试,以查看发送到服务器的调用。推送失败异常的详细信息是什么?现在编辑问题以插入整个异常。不知道Fiddler要看什么请注意,正常的表(没有离线同步)正在工作添加到服务器日志中
private AsyncTask<Void, Void, Void> initLocalStore() throws MobileServiceLocalStoreException, ExecutionException, InterruptedException {

        AsyncTask<Void, Void, Void> task = new AsyncTask<Void, Void, Void>() {
            @Override
            protected Void doInBackground(Void... params) {
                try {
                    mPullQuery = mClient.getTable(IrisEntry.class).where().orderBy("__createdAt", QueryOrder.Descending);

                    MobileServiceSyncContext syncContext = mClient.getSyncContext();
                    SQLiteLocalStore localStore = new SQLiteLocalStore(mClient.getContext(), "OfflineStore", null, 1);
                    SimpleSyncHandler handler = new SimpleSyncHandler();

                    Map<String, ColumnDataType> tableDefinition = new HashMap<String, ColumnDataType>();
                    tableDefinition.put("id", ColumnDataType.String);
                    tableDefinition.put("text", ColumnDataType.String);
                    tableDefinition.put("device", ColumnDataType.String);
                    tableDefinition.put("segmentationAlgo", ColumnDataType.String);
                    tableDefinition.put("imageUri", ColumnDataType.String);
                    tableDefinition.put("containerName", ColumnDataType.String);
                    tableDefinition.put("resourceName", ColumnDataType.String);
                    tableDefinition.put("sasQueryString", ColumnDataType.String);
                    tableDefinition.put("userId", ColumnDataType.String);
                    tableDefinition.put("complete", ColumnDataType.Boolean);

                    localStore.defineTable(Constants.TABLE_IRIS, tableDefinition);
                    syncContext.initialize(localStore, handler).get();

                    mIrisTable = mClient.getSyncTable(IrisEntry.class);
                } catch (final Exception e) {
                    e.printStackTrace();
                }

                return null;
            }
        };

        return runAsyncTask(task);
    }


 public void syncAsync() {
        if (isNetworkAvailable()) {
            new AsyncTask<Void, Void, Void>() {

                @Override
                protected Void doInBackground(Void... params) {
                    try {
                        mClient.getSyncContext().push().get();
                        mIrisTable.pull(mPullQuery).get();
                        Log.e(LOGTAG, "Success syncAsync");

                    } catch (Exception e) {
                        Log.e(LOGTAG, "Error syncAsync " + e.getMessage());
                        e.printStackTrace();

                    }
                    return null;
                }
            }.execute();
        } else {
            Log.e(LOGTAG, "You are not online, re-sync later!");
        }
    }

    private boolean isNetworkAvailable() {
        ConnectivityManager connectivityManager
                = (ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE);
        NetworkInfo activeNetworkInfo = connectivityManager.getActiveNetworkInfo();
        return activeNetworkInfo != null && activeNetworkInfo.isConnected();
    }
ERROR
{ [Error: getaddrinfo ENOTFOUND] code: 'ENOTFOUND', errno: 'ENOTFOUND', syscall: 'getaddrinfo' }