Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

阿里云OSS对象存储依赖引入失败 怎么解决 #40

Closed
wulangg opened this issue Aug 23, 2020 · 3 comments
Closed

阿里云OSS对象存储依赖引入失败 怎么解决 #40

wulangg opened this issue Aug 23, 2020 · 3 comments
Labels
help wanted Extra attention is needed

Comments

@wulangg
Copy link

wulangg commented Aug 23, 2020

我们鼓励使用英文,如果不能直接使用,可以使用翻译软件,您仍旧可以保留中文原文。
We recommend using English. If you are non-native English speaker, you can use the translation software.

Describe what problem you have encountered
A clear and concise description of what you want to do.

Describe what information you have read
eg. I have read the reference doc of Sentinel

@wulangg wulangg added the help wanted Extra attention is needed label Aug 23, 2020
@c297186864
Copy link

com.alibaba.cloud spring-cloud-alibaba-dependencies 2.2.1.RELEASE pom import

Cannot resolve com.alibaba.cloud:aliyun-oss-spring-boot-starter:unknown

@ms-xiaosnow
Copy link

ms-xiaosnow commented Aug 29, 2020

cause:

  1. spring-cloud-alibaba-dependencies 2.2.1.RELEASE pom didn't specify any version of "aliyun-oss-spring-boot-starter"
  2. "aliyun-oss-spring-boot-starter" use an incompatible version of "aliyun-java-sdk-core"

To fix this issue you could change your dependence as below:

<dependency>
    <groupId>com.alibaba.cloud</groupId>
    <artifactId>aliyun-oss-spring-boot-starter</artifactId>
    <version>1.0.0</version>
    <exclusions>
        <exclusion>
            <groupId>com.aliyun</groupId>
            <artifactId>aliyun-java-sdk-oss</artifactId>
        </exclusion>
    </exclusions>
</dependency>
<dependency>
    <groupId>com.aliyun</groupId>
    <artifactId>aliyun-java-sdk-core</artifactId>
    <version>4.5.7</version>
</dependency>

中文:
这玩意有坑,而且坑贼大,导致问题的主要原因:

  1. spring-cloud-alibaba的pom中没有声明指定的 aliyun-oss-spring-boot-starter 版本
  2. 指定了上述的版本之后,程序运行会报NoSuchMethodError (一看就想到了jar冲突的问题),找了一会才发现,starter中引入的alicloud-context与aliyun-java-sdk-core不兼容((lll¬ω¬),浪费了我1800s的生命)

解决方案,升级aliyun-java-sdk-core版本就好了,具体操作如下:

  1. 引入starter依赖的时候里边加上一个exclusions标签,把aliyun-java-sdk-core依赖排除掉
  2. 自己手动引入最新版本的aliyun-java-sdk-core依赖

按照上面的操作应该就万事大吉了,也不晓得后续还会不会有坑(此处严重怀疑程序猿没有测试过就把包发布到中央仓库。。。)

@theonefx
Copy link
Collaborator

please use "aliyun-spring-boot-dependencies" replace of "spring-cloud-alibaba-dependencies" while import "aliyun-oss-spring-boot-starter"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

4 participants