SpringCloud整合Nacos启动报错:com.alibaba.nacos.api.exception.NacosException: java.lang.reflect.InvocationT

追求适度,才能走向成功;人在顶峰,迈步就是下坡;身在低谷,抬足既是登高;弦,绷得太紧会断;人,思虑过度会疯;水至清无鱼,人至真无友,山至高无树;适度,不是中庸,而是一种明智的生活态度。

导读:本篇文章讲解 SpringCloud整合Nacos启动报错:com.alibaba.nacos.api.exception.NacosException: java.lang.reflect.InvocationT,希望对大家有帮助,欢迎收藏,转发!站点地址:www.bmabk.com,来源:原文

报错内容:

2022-04-25 10:09:01.575 ERROR 14136 — [ main]
o.s.c.a.nacos.NacosConfigProperties : create config service
error!properties=NacosConfigProperties{serverAddr=‘null’,
encode=‘null’, group=‘DEFAULT_GROUP’, prefix=‘null’,
fileExtension=‘properties’, timeout=3000, endpoint=‘null’,
namespace=‘null’, accessKey=‘null’, secretKey=‘null’,
contextPath=‘null’, clusterName=‘null’, name=‘null’,
sharedDataids=‘null’, refreshableDataids=‘null’, extConfig=null},e=,

com.alibaba.nacos.api.exception.NacosException:
java.lang.reflect.InvocationTargetException
at
com.alibaba.nacos.api.config.ConfigFactory.createConfigService(ConfigFactory.java:45)
~[nacos-api-1.1.4.jar:na] at
com.alibaba.nacos.api.NacosFactory.createConfigService(NacosFactory.java:43)
~[nacos-api-1.1.4.jar:na] at
org.springframework.cloud.alibaba.nacos.NacosConfigProperties.configServiceInstance(NacosConfigProperties.java:343)
~[spring-cloud-alibaba-nacos-config-0.2.2.RELEASE.jar:0.2.2.RELEASE]
at
org.springframework.cloud.alibaba.nacos.client.NacosPropertySourceLocator.locate(NacosPropertySourceLocator.java:63)
[spring-cloud-alibaba-nacos-config-0.2.2.RELEASE.jar:0.2.2.RELEASE]
at
org.springframework.cloud.bootstrap.config.PropertySourceBootstrapConfiguration.initialize(PropertySourceBootstrapConfiguration.java:94)
[spring-cloud-context-2.1.0.RELEASE.jar:2.1.0.RELEASE] at
org.springframework.boot.SpringApplication.applyInitializers(SpringApplication.java:623)
[spring-boot-2.1.11.RELEASE.jar:2.1.11.RELEASE] at
org.springframework.boot.SpringApplication.prepareContext(SpringApplication.java:367)
[spring-boot-2.1.11.RELEASE.jar:2.1.11.RELEASE] at
org.springframework.boot.SpringApplication.run(SpringApplication.java:311)
[spring-boot-2.1.11.RELEASE.jar:2.1.11.RELEASE] at
org.springframework.boot.SpringApplication.run(SpringApplication.java:1215)
[spring-boot-2.1.11.RELEASE.jar:2.1.11.RELEASE] at
org.springframework.boot.SpringApplication.run(SpringApplication.java:1204)
[spring-boot-2.1.11.RELEASE.jar:2.1.11.RELEASE] at
com.demo.api.AppMember.main(AppMember.java:19) [classes/:na]
在这里插入图片描述

问题原因
bootstrap.yml(bootstrap.properties)用来在程序引导时执行,应用于更加早期配置信息读取,如可以使用来配置application.yml中使用到参数等
application.yml(application.properties) 应用程序特有配置信息,可以用来配置后续各个模块中需使用的公共参数等。
解决方式
将application.yml修改为bootstrap.yml,重新启动
在这里插入图片描述

备注:
如果重启之后出现新的报错:

2022-04-25 10:45:02.032 ERROR 12412 — [ main]
o.s.boot.SpringApplication : Application run failed

org.springframework.beans.factory.BeanCreationException: Error
creating bean with name ‘memberServiceImpl’: Injection of autowired
dependencies failed; nested exception is
java.lang.IllegalArgumentException: Could not resolve placeholder
‘demo.userName’ in value “

d

e

m

o

.

u

s

e

r

N

a

m

e

a

t

o

r

g

.

s

p

r

i

n

g

f

r

a

m

e

w

o

r

k

.

b

e

a

n

s

.

f

a

c

t

o

r

y

.

a

n

n

o

t

a

t

i

o

n

.

A

u

t

o

w

i

r

e

d

A

n

n

o

t

a

t

i

o

n

B

e

a

n

P

o

s

t

P

r

o

c

e

s

s

o

r

.

p

o

s

t

P

r

o

c

e

s

s

P

r

o

p

e

r

t

i

e

s

(

A

u

t

o

w

i

r

e

d

A

n

n

o

t

a

t

i

o

n

B

e

a

n

P

o

s

t

P

r

o

c

e

s

s

o

r

.

j

a

v

a

:

382

)

 

[

s

p

r

i

n

g

b

e

a

n

s

5.1.12.

R

E

L

E

A

S

E

.

j

a

r

:

5.1.12.

R

E

L

E

A

S

E

]

a

t

o

r

g

.

s

p

r

i

n

g

f

r

a

m

e

w

o

r

k

.

b

e

a

n

s

.

f

a

c

t

o

r

y

.

s

u

p

p

o

r

t

.

A

b

s

t

r

a

c

t

A

u

t

o

w

i

r

e

C

a

p

a

b

l

e

B

e

a

n

F

a

c

t

o

r

y

.

p

o

p

u

l

a

t

e

B

e

a

n

(

A

b

s

t

r

a

c

t

A

u

t

o

w

i

r

e

C

a

p

a

b

l

e

B

e

a

n

F

a

c

t

o

r

y

.

j

a

v

a

:

1404

)

 

[

s

p

r

i

n

g

b

e

a

n

s

5.1.12.

R

E

L

E

A

S

E

.

j

a

r

:

5.1.12.

R

E

L

E

A

S

E

]

a

t

o

r

g

.

s

p

r

i

n

g

f

r

a

m

e

w

o

r

k

.

b

e

a

n

s

.

f

a

c

t

o

r

y

.

s

u

p

p

o

r

t

.

A

b

s

t

r

a

c

t

A

u

t

o

w

i

r

e

C

a

p

a

b

l

e

B

e

a

n

F

a

c

t

o

r

y

.

d

o

C

r

e

a

t

e

B

e

a

n

(

A

b

s

t

r

a

c

t

A

u

t

o

w

i

r

e

C

a

p

a

b

l

e

B

e

a

n

F

a

c

t

o

r

y

.

j

a

v

a

:

592

)

 

[

s

p

r

i

n

g

b

e

a

n

s

5.1.12.

R

E

L

E

A

S

E

.

j

a

r

:

5.1.12.

R

E

L

E

A

S

E

]

a

t

o

r

g

.

s

p

r

i

n

g

f

r

a

m

e

w

o

r

k

.

b

e

a

n

s

.

f

a

c

t

o

r

y

.

s

u

p

p

o

r

t

.

A

b

s

t

r

a

c

t

A

u

t

o

w

i

r

e

C

a

p

a

b

l

e

B

e

a

n

F

a

c

t

o

r

y

.

c

r

e

a

t

e

B

e

a

n

(

A

b

s

t

r

a

c

t

A

u

t

o

w

i

r

e

C

a

p

a

b

l

e

B

e

a

n

F

a

c

t

o

r

y

.

j

a

v

a

:

515

)

 

[

s

p

r

i

n

g

b

e

a

n

s

5.1.12.

R

E

L

E

A

S

E

.

j

a

r

:

5.1.12.

R

E

L

E

A

S

E

]

a

t

o

r

g

.

s

p

r

i

n

g

f

r

a

m

e

w

o

r

k

.

b

e

a

n

s

.

f

a

c

t

o

r

y

.

s

u

p

p

o

r

t

.

A

b

s

t

r

a

c

t

B

e

a

n

F

a

c

t

o

r

y

.

l

a

m

b

d

a

{demo.userName}” at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessProperties(AutowiredAnnotationBeanPostProcessor.java:382) ~[spring-beans-5.1.12.RELEASE.jar:5.1.12.RELEASE] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1404) ~[spring-beans-5.1.12.RELEASE.jar:5.1.12.RELEASE] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:592) ~[spring-beans-5.1.12.RELEASE.jar:5.1.12.RELEASE] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:515) ~[spring-beans-5.1.12.RELEASE.jar:5.1.12.RELEASE] at org.springframework.beans.factory.support.AbstractBeanFactory.lambda

demo.userNameatorg.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessProperties(AutowiredAnnotationBeanPostProcessor.java:382) [springbeans5.1.12.RELEASE.jar:5.1.12.RELEASE]atorg.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1404) [springbeans5.1.12.RELEASE.jar:5.1.12.RELEASE]atorg.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:592) [springbeans5.1.12.RELEASE.jar:5.1.12.RELEASE]atorg.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:515) [springbeans5.1.12.RELEASE.jar:5.1.12.RELEASE]atorg.springframework.beans.factory.support.AbstractBeanFactory.lambdadoGetBean$0(AbstractBeanFactory.java:320)
~[spring-beans-5.1.12.RELEASE.jar:5.1.12.RELEASE] at
org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
~[spring-beans-5.1.12.RELEASE.jar:5.1.12.RELEASE] at
org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:318)
~[spring-beans-5.1.12.RELEASE.jar:5.1.12.RELEASE] at
org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:199)
~[spring-beans-5.1.12.RELEASE.jar:5.1.12.RELEASE] at
org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:847)
~[spring-beans-5.1.12.RELEASE.jar:5.1.12.RELEASE] at
org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:877)
~[spring-context-5.1.12.RELEASE.jar:5.1.12.RELEASE] at
org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:549)
~[spring-context-5.1.12.RELEASE.jar:5.1.12.RELEASE] at
org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:141)
~[spring-boot-2.1.11.RELEASE.jar:2.1.11.RELEASE] at
org.springframework.boot.SpringApplication.refresh(SpringApplication.java:744)
[spring-boot-2.1.11.RELEASE.jar:2.1.11.RELEASE] at
org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:391)
[spring-boot-2.1.11.RELEASE.jar:2.1.11.RELEASE] at
org.springframework.boot.SpringApplication.run(SpringApplication.java:312)
[spring-boot-2.1.11.RELEASE.jar:2.1.11.RELEASE] at
org.springframework.boot.SpringApplication.run(SpringApplication.java:1215)
[spring-boot-2.1.11.RELEASE.jar:2.1.11.RELEASE] at
org.springframework.boot.SpringApplication.run(SpringApplication.java:1204)
[spring-boot-2.1.11.RELEASE.jar:2.1.11.RELEASE] at
com.demo.api.AppMember.main(AppMember.java:19) [classes/:na]
在这里插入图片描述
解决方式请参考:SpringCloud整合Nacos启动报错:Injection of autowired dependencies failed; nested exception is java.lang.Ill

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 举报,一经查实,本站将立刻删除。

文章由极客之音整理,本文链接:https://www.bmabk.com/index.php/post/131257.html

(0)
飞熊的头像飞熊bm

相关推荐

发表回复

登录后才能评论
极客之音——专业性很强的中文编程技术网站,欢迎收藏到浏览器,订阅我们!