Exception in thread "main" java.util.NoSuchElementException: An error occurred while enumerating the result, check the original exception for details.
at com.microsoft.azure.storage.core.LazySegmentedIterator.hasNext(LazySegmentedIterator.java:113)
at com.test.maven.azureBlob.main(azureBlob.java:47)
Caused by: com.microsoft.azure.storage.StorageException: The server encountered an unknown failure:
at com.microsoft.azure.storage.StorageException.translateException(StorageException.java:101)
at com.microsoft.azure.storage.core.ExecutionEngine.executeWithRetry(ExecutionEngine.java:199)
at com.microsoft.azure.storage.core.LazySegmentedIterator.hasNext(LazySegmentedIterator.java:109)
... 1 more
以上是尝试从Java创建存储桶时遇到的异常
以下是代码 公共类azureBlob { 公共静态最终字符串storageConnectionString = “ DefaultEndpointsProtocol = http;” + “ AccountName =;” + “ AccountKey =”;
public static void main(String[] args) throws InvalidKeyException, URISyntaxException, StorageException {
// TODO Auto-generated method stub
File sourceFile = null, downloadedFile = null;
System.out.println("Azure Blob storage quick start sample");
CloudStorageAccount storageAccount;
CloudBlobClient blobClient = null;
CloudBlobContainer container=null;
storageAccount = CloudStorageAccount.parse(storageConnectionString);
blobClient = storageAccount.createCloudBlobClient();
container = blobClient.getContainerReference("quickstartcontainer");
System.out.println("Creating container: " + container.getName());
try
{
container.createIfNotExists();
}
catch (Exception e)
{
System.out.println(e.getMessage());
}
//Listing contents of container
for (ListBlobItem blobItem : container.listBlobs()) {
System.out.println("URI of blob is: " + blobItem.getUri());
}
}
}
答案 0 :(得分:0)