You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@dubbo.apache.org by "mooseen (GitHub)" <gi...@apache.org> on 2020/01/02 16:29:36 UTC
[GitHub] [dubbo-spring-boot-project] mooseen opened issue #646: No
registry config found or it's not a valid config! The registry config is:
When configure dubbo service or reference bean by xml, the placeholder will not be replaced by user defined properties. if registry configuration not configured by `dubbo.registries.<registry id>` or has no default service registry configuration, it will throw an exception:
```java
Caused by: java.lang.IllegalStateException: No registry config found or it's not a valid config! The registry config is: <dubbo:registry valid="false" id="registry2" prefix="dubbo.registries." />
at org.apache.dubbo.config.AbstractInterfaceConfig.checkRegistry(AbstractInterfaceConfig.java:177)
at org.apache.dubbo.config.ReferenceConfig.createProxy(ReferenceConfig.java:306)
at org.apache.dubbo.config.ReferenceConfig.init(ReferenceConfig.java:266)
at org.apache.dubbo.config.ReferenceConfig.get(ReferenceConfig.java:151)
at org.apache.dubbo.config.spring.ReferenceBean.getObject(ReferenceBean.java:68)
at org.springframework.beans.factory.support.FactoryBeanRegistrySupport.doGetObjectFromFactoryBean(FactoryBeanRegistrySupport.java:171)
... 88 more
````
If we have default registry configuration (`dubbo.registry.xxx`), the reference bean defined in xml will using the default registry config even though we have configured registry in xml. if there is no default resgitry config, but configured by `dubbo.registries.<registry id>`,reference bean will using registry config defined by `dubbo.registries` if registry id was the same.
In both cases,the registry config defined in xml are not going to work and ignored by dubbo.
Following configuration can reporduce these exception described above.
- Dubbo: 2.7.5
- Dubbo Spring Boot : 2.7.5
- Spring Boot : 2.2.2.RELEASE
### case 1
This configuration will cause `No registry config found or it's not a valid config`.
`application.properties`
```ini
dubbo.application.id=demo
dubbo.application.name=demo
# true or false has no effect
#dubbo.config.multiple=true
dubbo.registries.registry1.id=registry1
dubbo.registries.registry1.address=zookeeper://localhost:2181
dubbo.registries.registry1.file=/Users/test/dubbo/registry/registry1
# this configuration is not working
dubbo.demo.registry=zookeeper://localhost:2181
dubbo.registry.file.path=/Users/test/dubbo/registry/registry2
```
`biz-consumer.xml`
```xml
<dubbo:registry id="registry2" address="${dubbo.demo.registry}" file="${dubbo.registry.file.path}" protocol="dubbo" version="1.0.0"/>
<dubbo:reference id="demoService2" registry="registry2" interface="io.test.dubbo.demo.api.DemoService" protocol="dubbo" version="1.0.0" check="false"/>
<bean id="barService" class="io.test.dubbo.demo.consumer.client.BarServiceImpl">
<property name="demoService" ref="demoService2"/>
</bean>
```
### case 2
This configuration will cause reference bean using default registry config even if we define it in XML.
`application.properties`
```ini
dubbo.application.id=demo
dubbo.application.name=demo
# default resgistry
# reference bean will use default registry config even if registry id are different.
dubbo.registry.id=registry1
dubbo.registry.address=zookeeper://localhost:2181
dubbo.registry.file=/Users/test/dubbo/registry/default
# this configuration is not going to work
dubbo.demo.registry=zookeeper://localhost:2181
dubbo.registry.file.path=/Users/test/dubbo/registry/registry2
```
`biz-consumer.xml`
```xml
<dubbo:registry id="registry2" address="${dubbo.demo.registry}" file="${dubbo.registry.file.path}" protocol="dubbo" version="1.0.0"/>
<dubbo:reference id="demoService2" registry="registry2" interface="io.test.dubbo.demo.api.DemoService" protocol="dubbo" version="1.0.0" check="false"/>
<bean id="barService" class="io.test.dubbo.demo.consumer.client.BarServiceImpl">
<property name="demoService" ref="demoService2"/>
</bean>
```
### case 3
This configuration will cause reference bean using registry defined by `dubbo.resgisties.xxx`
`application.properties`
```ini
dubbo.application.id=demo
dubbo.application.name=demo
dubbo.config.multiple=true
# registry 1 config
dubbo.registries.registry1.id=registry1
dubbo.registries.registry1.address=zookeeper://localhost:2181
dubbo.registries.registry1.file=/Users/test/dubbo/registry/registry1
# registry 2 config
# reference bean defined in xml will use this registry as registry id are the same
dubbo.registries.registry2.id=registry2
dubbo.registries.registry2.address=zookeeper://localhost:2181
dubbo.registries.registry2.file=/Users/test/dubbo/registry/registry2
# this config is still not going to work
dubbo.demo.registry=zookeeper://localhost:2181
dubbo.registry.file.path=/Users/test/dubbo/registry/registry2_xml
```
`biz-consumer.xml`
```xml
<dubbo:registry id="registry2" address="${dubbo.demo.registry}" file="${dubbo.registry.file.path}" protocol="dubbo" version="1.0.0"/>
<dubbo:reference id="demoService2" registry="registry2" interface="io.test.dubbo.demo.api.DemoService" protocol="dubbo" version="1.0.0" check="false"/>
<bean id="barService" class="io.test.dubbo.demo.consumer.client.BarServiceImpl">
<property name="demoService" ref="demoService2"/>
</bean>
```
[ Full content available at: https://github.com/apache/dubbo-spring-boot-project/issues/646 ]
This message was relayed via gitbox.apache.org for notifications@dubbo.apache.org
[GitHub] [dubbo-spring-boot-project] fujinjun commented on issue
#646: No registry config found or it's not a valid config if registry
configured by xml with placeholder
Posted by "fujinjun (GitHub)" <gi...@apache.org>.
在使用apollo注册中心的时候,也会有该问题,我们是consumer.xml中只包含dubbo:reference,其它的配置用apollo加载,会报同样的错,2.7.5也不行
[ Full content available at: https://github.com/apache/dubbo-spring-boot-project/issues/646 ]
This message was relayed via gitbox.apache.org for notifications@dubbo.apache.org