dubbo icon indicating copy to clipboard operation
dubbo copied to clipboard

GRPC service cannot register with Nacos registry

Open FinalVersion opened this issue 5 years ago • 2 comments

  • [x] I have searched the issues of this repository and believe that this is not a duplicate.
  • [x] I have checked the FAQ of this repository, but the link is broken.

Environment

  • Dubbo version: 2.7.6, 2.7.8
  • Operating System version: Windows 10
  • Java version: jdk1.8.0_172

Steps to reproduce this issue

  1. clone samples project https://github.com/apache/dubbo-samples.git
  2. add dependency nacos-client 1.3.3 for module dubbo-samples-grpc/dubbo-samples-original, and use nacos as registry in config file dubbo-demo-provider.xml
  3. run provider sample org.apache.dubbo.samples.basic.BasicProvider

Expected Result

provider starts and registers successfully

Actual Result

provider failed to register and log exception stack below

[25/01/21 02:53:12:012 CST] main ERROR client.naming: [NA] failed to request
ErrCode:400, ErrMsg:dom name can only have these characters: 0-9a-zA-Z-._:, current: DEFAULT_GROUP@@providers:io.grpc.examples.helloworld.DubboGreeterGrpc$IGreeter::

	at com.alibaba.nacos.client.naming.net.NamingProxy.callServer(NamingProxy.java:611)
	at com.alibaba.nacos.client.naming.net.NamingProxy.reqApi(NamingProxy.java:524)
	at com.alibaba.nacos.client.naming.net.NamingProxy.reqApi(NamingProxy.java:491)
	at com.alibaba.nacos.client.naming.net.NamingProxy.reqApi(NamingProxy.java:486)
	at com.alibaba.nacos.client.naming.net.NamingProxy.registerService(NamingProxy.java:239)
	at com.alibaba.nacos.client.naming.NacosNamingService.registerInstance(NacosNamingService.java:200)
	at org.apache.dubbo.registry.nacos.NacosRegistry.lambda$doRegister$1(NacosRegistry.java:160)
	at org.apache.dubbo.registry.nacos.NacosRegistry.execute(NacosRegistry.java:583)
	at org.apache.dubbo.registry.nacos.NacosRegistry.doRegister(NacosRegistry.java:160)
	at org.apache.dubbo.registry.support.FailbackRegistry.register(FailbackRegistry.java:240)
	at org.apache.dubbo.registry.ListenerRegistryWrapper.register(ListenerRegistryWrapper.java:57)
	at org.apache.dubbo.registry.integration.RegistryProtocol.register(RegistryProtocol.java:182)
	at org.apache.dubbo.registry.integration.RegistryProtocol.export(RegistryProtocol.java:218)
	at org.apache.dubbo.rpc.protocol.ProtocolFilterWrapper.export(ProtocolFilterWrapper.java:151)
	at org.apache.dubbo.rpc.protocol.ProtocolListenerWrapper.export(ProtocolListenerWrapper.java:60)
	at org.apache.dubbo.qos.protocol.QosProtocolWrapper.export(QosProtocolWrapper.java:64)
	at org.apache.dubbo.rpc.Protocol$Adaptive.export(Protocol$Adaptive.java)
	at org.apache.dubbo.config.ServiceConfig.doExportUrlsFor1Protocol(ServiceConfig.java:492)
	at org.apache.dubbo.config.ServiceConfig.doExportUrls(ServiceConfig.java:325)
	at org.apache.dubbo.config.ServiceConfig.doExport(ServiceConfig.java:300)
	at org.apache.dubbo.config.ServiceConfig.export(ServiceConfig.java:206)
	at org.apache.dubbo.config.bootstrap.DubboBootstrap.lambda$exportServices$16(DubboBootstrap.java:943)
	at java.util.HashMap$Values.forEach(HashMap.java:981)
	at org.apache.dubbo.config.bootstrap.DubboBootstrap.exportServices(DubboBootstrap.java:930)
	at org.apache.dubbo.config.bootstrap.DubboBootstrap.start(DubboBootstrap.java:749)
	at org.apache.dubbo.config.spring.context.DubboBootstrapApplicationListener.onContextRefreshedEvent(DubboBootstrapApplicationListener.java:59)
	at org.apache.dubbo.config.spring.context.DubboBootstrapApplicationListener.onApplicationContextEvent(DubboBootstrapApplicationListener.java:52)
	at org.apache.dubbo.config.spring.context.OneTimeExecutionApplicationContextEventListener.onApplicationEvent(OneTimeExecutionApplicationContextEventListener.java:40)
	at org.springframework.context.event.SimpleApplicationEventMulticaster.doInvokeListener(SimpleApplicationEventMulticaster.java:172)
	at org.springframework.context.event.SimpleApplicationEventMulticaster.invokeListener(SimpleApplicationEventMulticaster.java:165)
	at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:139)
	at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:393)
	at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:347)
	at org.springframework.context.support.AbstractApplicationContext.finishRefresh(AbstractApplicationContext.java:883)
	at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:546)
	at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:139)
	at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:83)
	at org.apache.dubbo.samples.basic.BasicProvider.main(BasicProvider.java:31)

linked issues

https://github.com/alibaba/nacos/issues/2968

FinalVersion avatar Jan 25 '21 07:01 FinalVersion

nacos service name just support 0-9a-zA-Z-._:. The service name should be compatible before register.

horizonzy avatar Mar 09 '21 03:03 horizonzy

close #7129 via #7346

AlbumenJ avatar Mar 25 '21 15:03 AlbumenJ