Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No such any registry to reference Exception happends When Consumer using ConfigCenterConfig #4652

Closed
2 tasks
slankka opened this issue Jul 24, 2019 · 2 comments
Closed
2 tasks

Comments

@slankka
Copy link
Contributor

slankka commented Jul 24, 2019

  • I have searched the issues of this repository and believe that this is not a duplicate.
  • I have checked the FAQ of this repository and believe that this is not a duplicate.

Environment

  • Dubbo version: 2.7.3 and 2.7.2
  • Operating System version: Windows 10
  • Java version: 1.8.0_151

Steps to reproduce this issue

  1. pom:
<dependency>
        <groupId>org.springframework.cloud</groupId>
        <artifactId>spring-cloud-alibaba-dependencies</artifactId>
        <exclusions>
          <exclusion>
            <groupId>org.apache.dubbo</groupId>
            <artifactId>dubbo</artifactId></exclusion>
        </exclusions>
        <version>0.9.0.RELEASE</version>
        <type>pom</type>
        <scope>import</scope>
      </dependency>

      <dependency>
        <groupId>org.apache.dubbo</groupId>
        <artifactId>dubbo</artifactId>
        <version>2.7.3</version>
        <exclusions>
          <exclusion>
            <groupId>org.springframework</groupId>
            <artifactId>spring</artifactId>
          </exclusion>
          <exclusion>
            <groupId>javax.servlet</groupId>
            <artifactId>servlet-api</artifactId>
          </exclusion>
          <exclusion>
            <groupId>log4j</groupId>
            <artifactId>log4j</artifactId>
          </exclusion>
        </exclusions>
      </dependency>
  1. create a configuration class, without any dubbo properties in local file.
@EnableDubbo(scanBasePackages = {"com.xxxx.rpc"})
@Configuration
public class DubboConfig {

    @Bean
    public ConfigCenterConfig configCenterConfig() {
        ConfigCenterConfig configCenterConfig = new ConfigCenterConfig();
        configCenterConfig.setAddress("apollo.xxxx.com");
        configCenterConfig.setProtocol("apollo");
        configCenterConfig.setNamespace("dubbo");
        configCenterConfig.setGroup(null);
        return configCenterConfig;
    }
}
  1. The RegistryAddress provided in Apollo namespace: dubbo:

property key: dubbo.properties
property value:

dubbo.application.name=Consumer
dubbo.application.qos-enable=false
dubbo.registry.address=zookeeper://zk.xxxxx.com?backup=zk2.xxxxx.com
dubbo.registry.simplified=true

as shown in picture:
http://dubbo.apache.org/img/apollo-configcenter-application.jpg

when add dubbo.registry.address=N/A to local properties file,the apollo config is truely resolved. but the problem exception still remain.

  1. The consumer code:
@Reference(version = "${xxxx.service.version}", retries = 0, lazy=true)
private IRExecutionService executionService;

I will provide full code to reproduce this issue if it's necessary.

Expected Result

The document shows ConfigCenterConfig support RegistryConfig.

Actual Result

What actually happens?

the exception trace:

Caused by: java.lang.IllegalStateException: No such any registry to reference com.xxx.yyy.IRExecutionService on the consumer a.b.c.d use dubbo version 2.7.3, please config <dubbo:registry address="..." /> to your spring config.
	at org.apache.dubbo.config.ReferenceConfig.createProxy(ReferenceConfig.java:390) ~[dubbo-2.7.3.jar:2.7.3]
	at org.apache.dubbo.config.ReferenceConfig.init(ReferenceConfig.java:329) ~[dubbo-2.7.3.jar:2.7.3]
	at org.apache.dubbo.config.ReferenceConfig.get(ReferenceConfig.java:250) ~[dubbo-2.7.3.jar:2.7.3]
	at org.apache.dubbo.config.spring.beans.factory.annotation.ReferenceAnnotationBeanPostProcessor$ReferenceBeanInvocationHandler.init(ReferenceAnnotationBeanPostProcessor.java:269) ~[dubbo-2.7.3.jar:2.7.3]
	at org.apache.dubbo.config.spring.beans.factory.annotation.ReferenceAnnotationBeanPostProcessor$ReferenceBeanInvocationHandler.access$100(ReferenceAnnotationBeanPostProcessor.java:242) ~[dubbo-2.7.3.jar:2.7.3]
	at org.apache.dubbo.config.spring.beans.factory.annotation.ReferenceAnnotationBeanPostProcessor.buildInvocationHandler(ReferenceAnnotationBeanPostProcessor.java:236) ~[dubbo-2.7.3.jar:2.7.3]
	at org.apache.dubbo.config.spring.beans.factory.annotation.ReferenceAnnotationBeanPostProcessor.buildProxy(ReferenceAnnotationBeanPostProcessor.java:219) ~[dubbo-2.7.3.jar:2.7.3]
	at org.apache.dubbo.config.spring.beans.factory.annotation.ReferenceAnnotationBeanPostProcessor.doGetInjectedBean(ReferenceAnnotationBeanPostProcessor.java:134) ~[dubbo-2.7.3.jar:2.7.3]
	at org.apache.dubbo.config.spring.beans.factory.annotation.AnnotationInjectedBeanPostProcessor.getInjectedObject(AnnotationInjectedBeanPostProcessor.java:360) ~[dubbo-2.7.3.jar:2.7.3]
	at org.apache.dubbo.config.spring.beans.factory.annotation.AnnotationInjectedBeanPostProcessor$AnnotatedFieldElement.inject(AnnotationInjectedBeanPostProcessor.java:540) ~[dubbo-2.7.3.jar:2.7.3]
	at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:90) ~[spring-beans-5.1.8.RELEASE.jar:5.1.8.RELEASE]
	at org.apache.dubbo.config.spring.beans.factory.annotation.AnnotationInjectedBeanPostProcessor.postProcessPropertyValues(AnnotationInjectedBeanPostProcessor.java:147) ~[dubbo-2.7.3.jar:2.7.3]
@CrazyHZM
Copy link
Member

add registry address port

@slankka
Copy link
Contributor Author

slankka commented Jul 25, 2019

The problem has been sovled. My variables in Apollo namespace dubbo should be expanded, but not as a property key dubbo.properties.

The document is not explicitly point out that Dubbo 2.7.2 and above has changed the storage model to adapt to Apollo.

BTW the Enhancement part of release note in apache-dubbo-2.7.2 mentioned #3266

@slankka slankka closed this as completed Jul 25, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants