开发者社区 > 云原生 > 正文

java程序调用ListAccessKeys,NoClassDefFoundError

java程序调用ListAccessKeys,出了下面的错。

错误信息

java.lang.NoClassDefFoundError: com/aliyun/gmsse/GMProvider


Caused by: java.lang.ClassNotFoundException: com.aliyun.gmsse.GMProvider
    at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:641)
    at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:188)
    at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:525)
    ... 4 more

代码是:


import com.aliyun.asapi.ASClient;
import com.aliyun.auth.credentials.Credential;
import com.aliyun.auth.credentials.provider.StaticCredentialProvider;
import com.aliyun.sdk.service.ram20150501.AsyncClient;
import com.aliyun.sdk.service.ram20150501.models.CreateAccessKeyRequest;
import com.aliyun.sdk.service.ram20150501.models.CreateAccessKeyResponse;
import com.aliyuncs.DefaultAcsClient;
import com.aliyuncs.exceptions.ClientException;
import com.aliyuncs.profile.DefaultProfile;
import com.aliyuncs.profile.IClientProfile;


public void ListAccessKeysTest(){
    ASClient client = new ASClient();
    client.setSdkSource("asapi-6460@asapi-inc.com");
    client.setIsFormat(false);
    // ASAPI的Endpoint地址
    String endpoint = "https://public.asapi.cn-hk-abcdefg.ali.cloud.cn.abcdefg/asapi/v3";
    Map<String, Object> parameters = new HashMap<String, Object>();
    parameters.put(ASClient.ACCESSKEY_ID, "asdfasdfasdgsdfgdsf");
    parameters.put(ASClient.ACCESSKEY_SECRET, "sfdshdfghdfgh");
    parameters.put(ASClient.REGIONID, "cn-hk-abcdefg");

    parameters.put(ASClient.PRODUCT, "Ram");
    parameters.put(ASClient.ACTION, "ListAccessKeys");
    parameters.put(ASClient.VERSION, "2015-05-01");

    Map<String, String> headers = new HashMap<String, String>();
    try {
        String result = client.doPost(endpoint, headers, parameters);
        System.out.println(result);
    } catch (Exception e) {
        e.printStackTrace();
    }
}

maven

        <dependency>
            <groupId>com.aliyun</groupId>
            <artifactId>asapi</artifactId>
        </dependency>
        <dependency>
            <groupId>com.aliyun</groupId>
            <artifactId>aliyun-java-sdk-core</artifactId>
        </dependency>

请问是不是maven包用错了, 请问有人知道怎么解决吗?

展开
收起
游客hqwuolqcmkpfs 2024-11-21 12:29:20 43 0
0 条回答
写回答
取消 提交回答
问答分类:
问答地址:

阿里云拥有国内全面的云原生产品技术以及大规模的云原生应用实践,通过全面容器化、核心技术互联网化、应用 Serverless 化三大范式,助力制造业企业高效上云,实现系统稳定、应用敏捷智能。拥抱云原生,让创新无处不在。

热门讨论

热门文章

相关电子书

更多
Spring Cloud Alibaba - 重新定义 Java Cloud-Native 立即下载
The Reactive Cloud Native Arch 立即下载
JAVA开发手册1.5.0 立即下载