【问题标题】:An error occurred while enumerating the result, check the original exception for details枚举结果时出错,详情查看原始异常
【发布时间】:2017-08-11 15:14:12
【问题描述】:

我目前在 Android Studio 上使用 Azure Blob 存储。我无法遍历 blob 容器

它告诉我

08-10 00:37:16.073 8538-8594/com.psv.starvision W/System.err: java.util.NoSuchElementException: An error occurred while enumerating the result, check the original exception for details.
08-10 00:37:16.073 8538-8594/com.psv.starvision W/System.err:     at com.microsoft.azure.storage.core.LazySegmentedIterator.hasNext(LazySegmentedIterator.java:113)
08-10 00:37:16.073 8538-8594/com.psv.starvision W/System.err:     at com.psv.starvision.blobHandler.ListImages(blobHandler.java:81)

Caused by: com.microsoft.azure.storage.StorageException: Server failed to authenticate the request. Make sure the value of Authorization header is formed correctly including the signature.
08-11 14:10:05.011 8877-8925/com.psv.starvision W/System.err:     at com.microsoft.azure.storage.core.StorageRequest.materializeException(StorageRequest.java:306)
08-11 14:10:05.011 8877-8925/com.psv.starvision W/System.err:     at com.microsoft.azure.storage.core.ExecutionEngine.executeWithRetry(ExecutionEngine.java:177)
08-11 14:10:05.011 8877-8925/com.psv.starvision W/System.err:     at com.microsoft.azure.storage.core.LazySegmentedIterator.hasNext(LazySegmentedIterator.java:109)

这是 ListImages.Class

public static String[] ListImages() {
    LinkedList<String> blobNames = new LinkedList<>();
    try {
        CloudBlobContainer container = getContainer();
        Log.e( "listimages: ", "container " + container );

        Iterable<ListBlobItem> blobs = container.listBlobs();
        Log.e( "listimages: ", "blobs " + blobs );

        blobNames = new LinkedList<>();
        for(ListBlobItem blob: blobs) { // the line that hit an error
            blobNames.add(((CloudBlockBlob) blob).getName());
        }

        Log.e("ListImages: ", "size" + blobNames.size() );
        return blobNames.toArray(new String[blobNames.size()]);

    } catch (Exception ex){
        ex.printStackTrace();
    }


    return blobNames.toArray(new String[blobNames.size()]);
}

有什么想法吗?有问题的容器不是空的;我可以登录containerblobs

请多谢!

【问题讨论】:

标签: android azure android-studio azure-blob-storage


【解决方案1】:

感谢您的帮助!

我的错误是在 gradle 脚本中

依赖已设置

compile group: 'com.microsoft.azure', name: 'azure-storage', version: '1.2.0'

应该是什么时候

compile 'com.microsoft.azure.android:azure-storage-android:0.8.0@aar'

【讨论】:

  • 我只使用了这个编译 'com.microsoft.azure.android:azure-storage-android:0.8.0@aar' 我仍然收到错误为“枚举结果时发生错误,请查看原始异常以获取详细信息。”你能建议我任何解决方案吗?
猜你喜欢
  • 2020-07-29
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2013-06-01
  • 2011-12-07
  • 1970-01-01
相关资源
最近更新 更多