hmhmh89019 2021-08-11 11:37 采纳率: 0%
浏览 10
已结题

Microsoft Azure table java 查询出错 Microsoft Azure table java 查询出错

最近正在学习使用Java操作Azure storage table 我正按照官方文档 尝试用实体接收从storage table查询出的数据
有报这个错。
贴上我的实体截图 和storage table 字段截图以及关键代码

报错:

Caused by: com.microsoft.azure.storage.table.TableServiceException: Server failed to authenticate the request. Make sure the value of Authorization header is formed correctly including the signature.
    at com.microsoft.azure.storage.table.TableServiceException.generateTableServiceException(TableServiceException.java:52)
    at com.microsoft.azure.storage.table.CloudTableClient$2.preProcessResponse(CloudTableClient.java:417)
    at com.microsoft.azure.storage.table.CloudTableClient$2.preProcessResponse(CloudTableClient.java:392)
    at com.microsoft.azure.storage.core.ExecutionEngine.executeWithRetry(ExecutionEngine.java:148)
    at com.microsoft.azure.storage.core.LazySegmentedIterator.hasNext(LazySegmentedIterator.java:109)

关键代码:

 public static void queryData() {
        try {
            // Define constants for filters.
            final String PARTITION_KEY = "PartitionKey";
            final String ROW_KEY = "RowKey";
            final String TIMESTAMP = "Timestamp";

            // Retrieve storage account from connection-string.
            CloudStorageAccount storageAccount =
                    CloudStorageAccount.parse(storageConnectionString);

            // Create the table client.
            CloudTableClient tableClient = storageAccount.createCloudTableClient();

            // Create a cloud table object for the table.
            CloudTable cloudTable = tableClient.getTableReference("TrackPage");

            // Create a filter condition where the partition key is "Smith".
            String partitionFilter = TableQuery.generateFilterCondition(
                    PARTITION_KEY,
                    QueryComparisons.EQUAL,
                    "o6FlbuA--3zEsy4pE_x4TCEzLoh8");

       /*     // Create a filter condition where the row key is less than the letter "E".
            String rowFilter = TableQuery.generateFilterCondition(
                    ROW_KEY,
                    QueryComparisons.LESS_THAN,
                    "E");

            // Combine the two conditions into a filter expression.
            String combinedFilter = TableQuery.combineFilters(partitionFilter,
                    Operators.AND, rowFilter);*/


            // Specify a range query, using "Smith" as the partition key,
            // with the row key being up to the letter "E".
            TableQuery<CustomerEntity> rangeQuery =
                    TableQuery.from(CustomerEntity.class)
                            .where(partitionFilter);

            // Loop through the results, displaying information about the entity
            Iterable<CustomerEntity> execute = cloudTable.execute(rangeQuery);

实体:


@Data
public class CustomerEntity implements TableEntity {

    public String CreateTime;
    public String Env;
    public String GuId;
    public String Type;
    public String UnionId;
    public String Url;
    ...

azure storage table 目标表

img

会不会是我的账户有问题?account和account_key

  • 写回答

1条回答 默认 最新

    报告相同问题?

    相关推荐 更多相似问题

    问题事件

    • 系统已结题 8月19日
    • 创建了问题 8月11日

    悬赏问题

    • ¥15 IP地址聚合什么情况才能同时聚合,什么情况又是先集合两个再加上最后一个
    • ¥15 mysql 选择求解答
    • ¥15 数据挖掘 决策树,文件报错
    • ¥15 编写生产者和消费者程序
    • ¥15 CSDN是个怎么样的平台
    • ¥15 java识别字符串内容并运算(输入为一行字符串,输出为整数)
    • ¥15 eclipse Java项目问题
    • ¥20 用记事本写一个login.jsp ,用以实现登陆界面,并通过post方式向Servlet传送页面数据
    • ¥15 关于链表的问题(为什么要在del函数结束后再创一个变量y)
    • ¥15 井字棋游戏-玩家与电脑