报错如下
Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
2020-12-18 14:25:21.108 ERROR 2176 --- [ main] o.s.boot.SpringApplication : Application run failed
java.lang.IllegalStateException: Invalid name="org.apache.dubbo.config.ApplicationConfig#0" contains illegal character, only digit, letter, '-', '_' or '.' is legal.
at org.apache.dubbo.config.utils.ConfigValidationUtils.checkProperty(ConfigValidationUtils.java:592) ~[dubbo-2.7.8.jar:2.7.8]
at org.apache.dubbo.config.utils.ConfigValidationUtils.checkName(ConfigValidationUtils.java:548) ~[dubbo-2.7.8.jar:2.7.8]
我的yml配置是
server:
port: 8081
spring:
# application:
# name: service-provider
dubbo:
application:
id: service-provider #dubbo提供者的别名,只是个标识
base-package: com.example.dubboprovider.ProviderServiceImpl # dubbo服务发布者所在的包
registry:
address: 47.98.157.xx # zookeeper注册中心的地址
port: 2181 # zookeeper注册中心的端口
protocol: zookeeper
register: true
protocol:
name: dubbo #dubbo协议
port: 20880 #duboo端口号
accesslog: true
provider:
retries: 1
delay: -1
经过多此实验后,解决方案如下
server:
port: 8081
spring:
application:
name: service-provider
dubbo:
application:
id: service-provider #dubbo提供者的别名,只是个标识
base-package: com.example.dubboprovider.ProviderServiceImpl # dubbo服务发布者所在的包
registry:
address: 47.98.157.XX # zookeeper注册中心的地址
port: 2181 # zookeeper注册中心的端口
protocol: zookeeper
register: true
protocol:
name: dubbo #dubbo协议
port: 20880 #duboo端口号
accesslog: true
provider:
retries: 1
delay: -1
打开注释即可
spring:
application:
name: service-provider