You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@dubbo.apache.org by "a601942905git (GitHub)" <gi...@apache.org> on 2018/10/30 02:14:00 UTC

[GitHub] [incubator-dubbo] a601942905git opened issue #2707: why dubbo rest protocol need to configure the registry?

when i test dubbo rest protocol, i configure like this according the office website
```
    <dubbo:application name="dubbo-rest"/>

    <!--<dubbo:registry address="zookeeper://127.0.0.1:2181"/>-->

    <!-- 用rest协议在8080端口暴露服务 -->
    <dubbo:protocol name="rest" port="8081" server="tomcat"/>

    <!-- 声明需要暴露的服务接口 -->
    <dubbo:service interface="com.boot.dubbo.CustomerService" ref="customerService"/>

    <!-- 和本地bean一样实现服务 -->
    <bean id="customerService" class="com.boot.dubbo.CustomerServiceImpl" />
```
but the error occur like this
```
java.lang.IllegalStateException: No such any registry to export service in provider 172.19.6.61 use dubbo version 2.6.2, Please add <dubbo:registry address="..." /> to your spring config. If you want unregister, please set <dubbo:service registry="N/A" />
	at com.alibaba.dubbo.config.AbstractInterfaceConfig.checkRegistry(AbstractInterfaceConfig.java:120) ~[dubbo-2.6.2.jar:2.6.2]
	at com.alibaba.dubbo.config.ServiceConfig.doExport(ServiceConfig.java:310) ~[dubbo-2.6.2.jar:2.6.2]
	at com.alibaba.dubbo.config.ServiceConfig.export(ServiceConfig.java:216) ~[dubbo-2.6.2.jar:2.6.2]
	at com.alibaba.dubbo.config.spring.ServiceBean.onApplicationEvent(ServiceBean.java:123) ~[dubbo-2.6.2.jar:2.6.2]
	at com.alibaba.dubbo.config.spring.ServiceBean.onApplicationEvent(ServiceBean.java:49) ~[dubbo-2.6.2.jar:2.6.2]
	at org.springframework.context.event.SimpleApplicationEventMulticaster.doInvokeListener(SimpleApplicationEventMulticaster.java:172) ~[spring-context-5.0.10.RELEASE.jar:5.0.10.RELEASE]
	at org.springframework.context.event.SimpleApplicationEventMulticaster.invokeListener(SimpleApplicationEventMulticaster.java:165) ~[spring-context-5.0.10.RELEASE.jar:5.0.10.RELEASE]
	at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:139) ~[spring-context-5.0.10.RELEASE.jar:5.0.10.RELEASE]
	at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:400) ~[spring-context-5.0.10.RELEASE.jar:5.0.10.RELEASE]
	at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:354) ~[spring-context-5.0.10.RELEASE.jar:5.0.10.RELEASE]
	at org.springframework.context.support.AbstractApplicationContext.finishRefresh(AbstractApplicationContext.java:886) ~[spring-context-5.0.10.RELEASE.jar:5.0.10.RELEASE]
	at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.finishRefresh(ServletWebServerApplicationContext.java:161) ~[spring-boot-2.0.6.RELEASE.jar:2.0.6.RELEASE]
	at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:551) ~[spring-context-5.0.10.RELEASE.jar:5.0.10.RELEASE]
	at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:140) ~[spring-boot-2.0.6.RELEASE.jar:2.0.6.RELEASE]
	at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:754) [spring-boot-2.0.6.RELEASE.jar:2.0.6.RELEASE]
	at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:386) [spring-boot-2.0.6.RELEASE.jar:2.0.6.RELEASE]
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:307) [spring-boot-2.0.6.RELEASE.jar:2.0.6.RELEASE]
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:1242) [spring-boot-2.0.6.RELEASE.jar:2.0.6.RELEASE]
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:1230) [spring-boot-2.0.6.RELEASE.jar:2.0.6.RELEASE]
	at com.boot.dubbo.DubboRestApplication.main(DubboRestApplication.java:18) [classes/:na]

```
it is mean that i need to configure registry,when i configure registry,it works well.but i do not know why?the office website also does not specify
if you need the code expample to test,i can provide for you
please click the link[Dubbo-Rest](https://github.com/a601942905git/boot-dubbo/tree/master/boot-dubbo-rest)

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

[GitHub] [incubator-dubbo] Jeff-Lv commented on issue #2707: why dubbo rest protocol need to configure the registry?

Posted by "Jeff-Lv (GitHub)" <gi...@apache.org>.
> but the office doc describe like this
> 
> ```
> <!-- 用rest协议在8080端口暴露服务 -->
> <dubbo:protocol name="rest" port="8080"/>
> 
> <!-- 声明需要暴露的服务接口 -->
> <dubbo:service interface="xxx.UserService" ref="userService"/>
> 
> <!-- 和本地bean一样实现服务 -->
> <bean id="userService" class="xxx.UserServiceImpl" />
> ```
> Make it easy for us to make mistakes, i think if posibble,the dubbo:registry should be removed.
> What do you think?
 Two thinkings here.
1) If the dubbo:registry is removed, the service will not be registered to anywhere. How can a consumer of the service get the addresses? by static DNS?  or some other way? 

2)If the dubbo:registry is removed, a default registry will be used. What‘s the default?  I think it is hard to choose a default behavior for Dubbo because of its open and versatility. A product based Dubbo can extend to implement the default one according the specific scenario.  

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

[GitHub] [incubator-dubbo] zonghaishang commented on issue #2707: why dubbo rest protocol need to configure the registry?

Posted by "zonghaishang (GitHub)" <gi...@apache.org>.
`<dubbo:registry address="registryprotocol://ip:port"/>` is required.

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


[GitHub] [incubator-dubbo] Jeff-Lv commented on issue #2707: why dubbo rest protocol need to configure the registry?

Posted by "Jeff-Lv (GitHub)" <gi...@apache.org>.
I don't think it is a issue for it is the normal logic and registry config is must needed whatever provider/consumer. 
As the log printing,  if you want unregister, please set <dubbo:service registry="N/A" />

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


[GitHub] [incubator-dubbo] a601942905git commented on issue #2707: why dubbo rest protocol need to configure the registry?

Posted by "a601942905git (GitHub)" <gi...@apache.org>.
but the office doc describe like this
```
<!-- 用rest协议在8080端口暴露服务 -->
<dubbo:protocol name="rest" port="8080"/>

<!-- 声明需要暴露的服务接口 -->
<dubbo:service interface="xxx.UserService" ref="userService"/>

<!-- 和本地bean一样实现服务 -->
<bean id="userService" class="xxx.UserServiceImpl" />
```
Make it easy for us to make mistakes, i think if posibble,the <dubbo:registry> should be removed.
What do you think?

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

[GitHub] [incubator-dubbo] zonghaishang commented on issue #2707: why dubbo rest protocol need to configure the registry?

Posted by "zonghaishang (GitHub)" <gi...@apache.org>.
you can refer : https://github.com/a601942905git/boot-dubbo

```
注意事项
rest协议调用
一定要添加注册中心
@Bean
public RegistryConfig registryConfig() {
  RegistryConfig registryConfig = new RegistryConfig();
  registryConfig.setAddress("N/A");
  return registryConfig;
}
```

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

[GitHub] [incubator-dubbo] a601942905git commented on issue #2707: why dubbo rest protocol need to configure the registry?

Posted by "a601942905git (GitHub)" <gi...@apache.org>.
The rest service is not available as described in the official documentation

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


[GitHub] [incubator-dubbo] zonghaishang closed issue #2707: why dubbo rest protocol need to configure the registry?

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

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


[GitHub] [incubator-dubbo] Jeff-Lv commented on issue #2707: why dubbo rest protocol need to configure the registry?

Posted by "Jeff-Lv (GitHub)" <gi...@apache.org>.
> but the office doc describe like this
> 
> ```
> <!-- 用rest协议在8080端口暴露服务 -->
> <dubbo:protocol name="rest" port="8080"/>
> 
> <!-- 声明需要暴露的服务接口 -->
> <dubbo:service interface="xxx.UserService" ref="userService"/>
> 
> <!-- 和本地bean一样实现服务 -->
> <bean id="userService" class="xxx.UserServiceImpl" />
> ```
> Make it easy for us to make mistakes, i think if posibble,the dubbo:registry should be removed.
> What do you think?
 Two thinkings here.
1) If the dubbo:registry is removed, the service will not be registered to anywhere. How can a consumer of the service get the addresses? by static DNS?  or some other way? 

2) If the dubbo:registry is removed, a default registry will be used. What‘s the default?  I think it is hard to choose a default behavior for Dubbo because of its open and versatility. A product based Dubbo can extend to implement the default one according the specific scenario.  

Which opinion is the better and what is persuasive reasons? 

So I think Dubbo can keep the current way without any fixings here.


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

[GitHub] [incubator-dubbo] Jeff-Lv commented on issue #2707: why dubbo rest protocol need to configure the registry?

Posted by "Jeff-Lv (GitHub)" <gi...@apache.org>.
> but the office doc describe like this
> 
> ```
> <!-- 用rest协议在8080端口暴露服务 -->
> <dubbo:protocol name="rest" port="8080"/>
> 
> <!-- 声明需要暴露的服务接口 -->
> <dubbo:service interface="xxx.UserService" ref="userService"/>
> 
> <!-- 和本地bean一样实现服务 -->
> <bean id="userService" class="xxx.UserServiceImpl" />
> ```
> Make it easy for us to make mistakes, i think if posibble,the dubbo:registry should be removed.
> What do you think?
 Two thinkings here.
1) If the dubbo:registry is removed, the service will not be registered to anywhere. How can a consumer of the service get the addresses? by static DNS?  or some other way? 

2) If the dubbo:registry is removed, a default registry will be used. What‘s the default?  I think it is hard to choose a default behavior for Dubbo because of its open and versatility. A product based Dubbo can extend to implement the default one according the specific scenario.  

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