apache / dubbo-spring-boot-project

Spring Boot Project for Apache Dubbo
https://dubbo.apache.org
Apache License 2.0
5.41k stars 1.88k forks source link

nacos示例中的provider启动出错 #640

Closed AiHaoChen closed 4 years ago

AiHaoChen commented 4 years ago
在提供的示例中的samples中的dubbo-registry-nacos-samples例子,启动provider出错。例子中的provider是使用application.properties作为配置文件的,使用application.properties能正常启动并注册provider。但是,我根据application.properties修改为application.yml,启动就报错。报错如下:

java.lang.IllegalStateException: No registry config found or it's not a valid config! The registry config is: at org.apache.dubbo.config.AbstractInterfaceConfig.checkRegistry(AbstractInterfaceConfig.java:203) at org.apache.dubbo.config.ServiceConfig.checkAndUpdateSubConfigs(ServiceConfig.java:303) at org.apache.dubbo.config.ServiceConfig.export(ServiceConfig.java:370) at org.apache.dubbo.config.spring.ServiceBean.export(ServiceBean.java:336) at org.apache.dubbo.config.spring.ServiceBean.onApplicationEvent(ServiceBean.java:114) at org.apache.dubbo.config.spring.ServiceBean.onApplicationEvent(ServiceBean.java:60) at org.springframework.context.event.SimpleApplicationEventMulticaster.doInvokeListener(SimpleApplicationEventMulticaster.java:172) at org.springframework.context.event.SimpleApplicationEventMulticaster.invokeListener(SimpleApplicationEventMulticaster.java:165) at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:139) at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:403) at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:360) at org.springframework.context.support.AbstractApplicationContext.finishRefresh(AbstractApplicationContext.java:897) at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:553) at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:747) at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:397) at org.springframework.boot.SpringApplication.run(SpringApplication.java:315) at org.springframework.boot.builder.SpringApplicationBuilder.run(SpringApplicationBuilder.java:140) at club.chenzhong.dubbo.provicder.DubboSbProviderApplication.main(DubboSbProviderApplication.java:11) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at org.springframework.boot.devtools.restart.RestartLauncher.run(RestartLauncher.java:49) 另外,同例子中的consumer,我根据application.yml修改配置文件为application.properties,consumer能正常启动。 provider的properties配置如图:

图片

provider的yml配置如图:

图片

我尝试DEBUG了一下,发现spring不能读取到yml中的配置信息,奈何本人技术有限,不能知道为什么Spring获取不到yml中的配置信息。

SpringBoot版本为:2.2.2.RELEASE dubbo-registry-nacos与dubbo-spring-boot-starter版本为: 2.7.4.1 nacos-client的版本为:1.1.4

mercyblitz commented 4 years ago

Please check your YAML file format, the sample also uses the YAML file as a property source.