谷粒商城ThirdPartyApplication启动报错: Oss endpoint can‘t be empty解决总结

我创建的项目引入Springboot版本:2.6.13,Springcloud版本:2021.0.5,Spring-cloud-aplibaba版本:2021.0.5.0,nacos版本:2.2.1.RELEASE。项目在父pom.xml中使用dependencyManagement减少子项目重复引入jar,统一版本的管理。

最近学习谷粒商城P63 OSS云存储练手时,运行创建第三方服务GulimallThirdPartyApplication.java报错:Oss endpoint can't be empty

Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [com.aliyun.oss.OSS]: Factory method 'ossClient' threw exception; nested exception is java.lang.IllegalArgumentException: Oss endpoint can't be empty.
	at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:185) ~[spring-beans-5.3.23.jar:5.3.23]
	at org.springframework.beans.factory.support.ConstructorResolver.instantiate(ConstructorResolver.java:653) ~[spring-beans-5.3.23.jar:5.3.23]
	... 19 common frames omitted
Caused by: java.lang.IllegalArgumentException: Oss endpoint can't be empty.
	at org.springframework.util.Assert.isTrue(Assert.java:121) ~[spring-core-5.3.23.jar:5.3.23]
	at com.alibaba.alicloud.context.oss.OssContextAutoConfiguration.ossClient(OssContextAutoConfiguration.java:53) ~[spring-cloud-alicloud-context-2.2.0.RELEASE.jar:2.2.0.RELEASE]
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_221]
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_221]
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_221]
	at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_221]
	at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:154) ~[spring-beans-5.3.23.jar:5.3.23]
	... 20 common frames omitted

单独把oss.yml的配置放到application.yml中运行正常,但把oss.yml的提取出来配置到Nacos的配置中心运行就报这个错,搞得郁闷得很,一阵网上搜索解决了。

在网上搜索这种报错总结大概分为3种情况:

第一种

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值