原 Spring cloud Alibaba集成OSS报错:An attempt was made to call a method that does not exist. The attempt wa
版权声明:本文为博主原创文章,请尊重他人的劳动成果,转载请附上原文出处链接和本声明。
本文链接:https://www.91mszl.com/zhangwuji/article/details/1393
<dependency>
<groupId>com.alibaba.cloud</groupId>
<artifactId>aliyun-oss-spring-boot-starter</artifactId>
<version>1.0.0</version>
</dependency>
***************************
APPLICATION FAILED TO START
***************************
Description:
An attempt was made to call a method that does not exist. The attempt was made from the following location:
com.alibaba.cloud.context.AliCloudSdk.<init>(AliCloudSdk.java:76)
The following method did not exist:
com.aliyuncs.profile.DefaultProfile.getHttpClientConfig()Lcom/aliyuncs/http/HttpClientConfig;
The method's class, com.aliyuncs.profile.DefaultProfile, is available from the following locations:
jar:file:/D:/mvnrepository/com/aliyun/aliyun-java-sdk-core/3.4.0/aliyun-java-sdk-core-3.4.0.jar!/com/aliyuncs/profile/DefaultProfile.class
The class hierarchy was loaded from the following locations:
com.aliyuncs.profile.DefaultProfile: file:/D:/mvnrepository/com/aliyun/aliyun-java-sdk-core/3.4.0/aliyun-java-sdk-core-3.4.0.jar
Action:
Correct the classpath of your application so that it contains a single, compatible version of com.aliyuncs.profile.DefaultProfile
大概意思是 aliyun-java-sdk-core-3.4.0.jar和我们项目中的 spring-boot版本冲突导致的,我们使用spring-boot版本为2.4.2
引入更高版本的 aliyun-java-sdk-core
<dependency>
<groupId>com.aliyun</groupId>
<artifactId>aliyun-java-sdk-core</artifactId>
<version>4.6.0</version>
</dependency>
2022-05-11 14:52:31 阅读(1150)
名师出品,必属精品 https://www.91mszl.com
博主信息