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包用错了, 请问有人知道怎么解决吗?
版权声明:本文内容由阿里云实名注册用户自发贡献,版权归原作者所有,阿里云开发者社区不拥有其著作权,亦不承担相应法律责任。具体规则请查看《阿里云开发者社区用户服务协议》和《阿里云开发者社区知识产权保护指引》。如果您发现本社区中有涉嫌抄袭的内容,填写侵权投诉表单进行举报,一经查实,本社区将立刻删除涉嫌侵权内容。
阿里云拥有国内全面的云原生产品技术以及大规模的云原生应用实践,通过全面容器化、核心技术互联网化、应用 Serverless 化三大范式,助力制造业企业高效上云,实现系统稳定、应用敏捷智能。拥抱云原生,让创新无处不在。