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

2年前 (2022) 程序员胖胖胖虎阿
410 0 0

报错内容:

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]
SpringCloud整合Nacos启动报错:com.alibaba.nacos.api.exception.NacosException: java.lang.reflect.InvocationT

问题原因
bootstrap.yml(bootstrap.properties)用来在程序引导时执行,应用于更加早期配置信息读取,如可以使用来配置application.yml中使用到参数等
application.yml(application.properties) 应用程序特有配置信息,可以用来配置后续各个模块中需使用的公共参数等。
解决方式
将application.yml修改为bootstrap.yml,重新启动
SpringCloud整合Nacos启动报错:com.alibaba.nacos.api.exception.NacosException: java.lang.reflect.InvocationT

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

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.userName"atorg.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启动报错:com.alibaba.nacos.api.exception.NacosException: java.lang.reflect.InvocationT
解决方式请参考:SpringCloud整合Nacos启动报错:Injection of autowired dependencies failed; nested exception is java.lang.Ill

相关文章

暂无评论

暂无评论...