当我尝试在表存储中创建表时,为什么会出现以下错误:
com.microsoft.azure.storage.StorageException.translateException(StorageException.java:87),com.microsoft.azure.storage.core.ExecutionEngine.executeWithRetry(ExecutionEngine.java:209),com.microsoft.azure.storage.table.QueryTableOperation.performRetrieve(QueryTableOperation.java:178),com.microsoft.azure.storage.table.TableOperation.execute(TableOperation.java:694),com.microsoft.azure.storage.table.CloudTablecom.microsoft.azure.storage.table.CloudTable.createIfNotExists(CloudTable.java:290) at com.microsoft.azure.storage.table.CloudTable.createIfNotExists(CloudTable.java:265) be.dela.gdprvault.test.StorageTestClient.getTableByName(StorageTestClient.groovy:25) at be.dela.gdprvault.logging.entity.ActionLogSystemSpec.getActionLogFromTableByPartitionAndRowKey(ActionLogSystemSpec.groovy:114) at be.dela.gdprvault.logging.entity.ActionLogSystemSpec.should .exists(CloudTable.java:888)将com.microsoft.azure.storage.table.TableDeserializer.parseJsonEntity(TableDeserializer.java:290)的ActionLog实体保存到表存储(ActionLogSystemSpec.groovy:96)中,这是由: java.lang.NullPointerException at ActionLog at com.microsoft.azure.storage.table.QueryTableOperation.parseResponse(QueryTableOperation.java:143) at com.microsoft.azure.storage.table.QueryTableOperation$1.postProcessResponse(QueryTableOperation.java:236)引起的在com.microsoft.azure.storage.table.QueryTableOperation$1.postProcessResponse(QueryTableOperation.java:193) at com.microsoft.azure.storage.core.ExecutionEngine.executeWithRetry(ExecutionEngine.java:155) .还有8家
docer-compose
azure-blob-storage:
image: arafato/azurite
ports:
- "10000:10000"
- "10002:10002"
volumes:
- data-volume:/opt/azurite/folder
CloudTable table = tableClient.getTableReference(tableName)
table.createIfNotExists() -- there is error我是按照https://learn.microsoft.com/en-us/azure/cosmos-db/table-storage-how-to-use-java的文章写的
发布于 2018-11-01 06:53:32
我试图复制你的例外,但失败了。您可以使用费德勒捕获java代码的请求和响应,以检查状态代码和错误详细信息。
您可以参考我的工作代码:
import com.microsoft.azure.storage.*;
import com.microsoft.azure.storage.table.*;
public class CreateTableTest {
public static final String storageConnectionString =
"DefaultEndpointsProtocol=https;" +
"AccountName=***;" +
"AccountKey=***;" +
"TableEndpoint=https://***.table.cosmosdb.azure.com:443/;" ;
public static void main(String[] args) {
try
{
// Retrieve storage account from connection-string.
CloudStorageAccount storageAccount =
CloudStorageAccount.parse(storageConnectionString);
// Create the table client.
CloudTableClient tableClient = storageAccount.createCloudTableClient();
// Create the table if it doesn't exist.
String tableName = "people";
CloudTable cloudTable = tableClient.getTableReference(tableName);
cloudTable.createIfNotExists();
System.out.println("Create Success...");
}
catch (Exception e)
{
// Output the stack trace.
e.printStackTrace();
}
}
}我的sdk版本是:
<dependency>
<groupId>com.microsoft.azure</groupId>
<artifactId>azure-storage</artifactId>
<version>8.0.0</version>
</dependency>https://stackoverflow.com/questions/53089470
复制相似问题