91名师指路-头部
91名师指路

Spring cloud Alibaba集成OSS报错:An attempt was made to call a method that does not exist. The attempt wa

由于某些原因,现在不支持支付宝支付,如需要购买源码请加博主微信进行购买,微信号:13248254750

一:Spring cloud Alibaba集成OSS,引入的pom如下

<dependency>
<groupId>com.alibaba.cloud</groupId>
<artifactId>aliyun-oss-spring-boot-starter</artifactId>
<version>1.0.0</version>
</dependency>


二:spring cloud alibaba集成OSS报错如下:

***************************
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     阅读(998)

名师出品,必属精品    https://www.91mszl.com

联系博主    
用户登录遮罩层
x

账号登录

91名师指路-底部