You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@dubbo.apache.org by "qinliujie (GitHub)" <gi...@apache.org> on 2018/12/25 07:38:00 UTC

[GitHub] [incubator-dubbo] qinliujie opened issue #3056: org.apache.dubbo.config.AbstractInterfaceConfig#setRegistry(java.lang.String) does't work

- [x] I have searched the [issues](https://github.com/apache/incubator-dubbo/issues) of this repository and believe that this is not a duplicate.
- [x] I have checked the [FAQ](https://github.com/apache/incubator-dubbo/blob/master/FAQ.md) of this repository and believe that this is not a duplicate.

### Environment

* Dubbo version: 2.7.0

### Steps to reproduce this issue

        ReferenceConfig  referenceConfig = new ReferenceConfig();

        //application
        String appName = AppInfoUtils.getAppName();
        ApplicationConfig applicationConfig = new ApplicationConfig();
        applicationConfig.setName(appName);
        referenceConfig.setApplication(applicationConfig);

        //registry
        //zookeeper://127.0.0.1:2181
        referenceConfig.setRegistry("zookeeper://127.0.0.1:2181");
        ......

### Expected Result

it can use zookeeper registry

### Actual Result

it does't work

```
java.lang.IllegalStateException: No registry config found or it's not a valid config! The registry config is: <dubbo:registry zookeeperProtocol="false" valid="false" id="zookeeper://127.0.0.1:2181" prefix="dubbo.registries." />

	at org.apache.dubbo.config.AbstractInterfaceConfig.checkRegistry(AbstractInterfaceConfig.java:129)
	at org.apache.dubbo.config.AbstractInterfaceConfig.loadRegistries(AbstractInterfaceConfig.java:198)
	at org.apache.dubbo.config.ReferenceConfig.createProxy(ReferenceConfig.java:358)
	at org.apache.dubbo.config.ReferenceConfig.init(ReferenceConfig.java:314)
	at org.apache.dubbo.config.ReferenceConfig.get(ReferenceConfig.java:232)
```


[ Full content available at: https://github.com/apache/incubator-dubbo/issues/3056 ]
This message was relayed via gitbox.apache.org for notifications@dubbo.apache.org


[GitHub] [incubator-dubbo] zonghaishang closed issue #3056: org.apache.dubbo.config.AbstractInterfaceConfig#setRegistry(java.lang.String) does't work

Posted by "zonghaishang (GitHub)" <gi...@apache.org>.
[ issue closed by zonghaishang ]

[ Full content available at: https://github.com/apache/incubator-dubbo/issues/3056 ]
This message was relayed via gitbox.apache.org for notifications@dubbo.apache.org


[GitHub] [incubator-dubbo] zonghaishang commented on issue #3056: org.apache.dubbo.config.AbstractInterfaceConfig#setRegistry(java.lang.String) does't work

Posted by "zonghaishang (GitHub)" <gi...@apache.org>.
@qinliujie  chickenlj is right.

[ Full content available at: https://github.com/apache/incubator-dubbo/issues/3056 ]
This message was relayed via gitbox.apache.org for notifications@dubbo.apache.org


[GitHub] [incubator-dubbo] chickenlj commented on issue #3056: org.apache.dubbo.config.AbstractInterfaceConfig#setRegistry(java.lang.String) does't work

Posted by "chickenlj (GitHub)" <gi...@apache.org>.
Here is the right way to use:

```java
    //registry
    //zookeeper://127.0.0.1:2181
    referenceConfig.setRegistry("registryId"); // registryId is a reference of a RegistryConfig you defined locally or in Config Center.
    ......
```
or
```java
    //registry
    //zookeeper://127.0.0.1:2181
   RegistryConfig registryConfig = new RegistryConfig();
   registryConfig.setAddress("zookeeper://127.0.0.1:2181");
    referenceConfig.setRegistry(registryConfig);
    ......
```


[ Full content available at: https://github.com/apache/incubator-dubbo/issues/3056 ]
This message was relayed via gitbox.apache.org for notifications@dubbo.apache.org