apache / dubbo-go-samples

Apache dubbo
https://dubbo.apache.org/
Apache License 2.0
233 stars 185 forks source link

使用泛化示例,dubbo-go3.1.1 调用 java server 2.6.x,提示 No provider available for the service #729

Open liusese opened 6 months ago

liusese commented 6 months ago
import(
  "dubbo.apache.org/dubbo-go/v3/config"
  "dubbo.apache.org/dubbo-go/v3/config/generic"
  _ "dubbo.apache.org/dubbo-go/v3/imports"
  hessian "github.com/apache/dubbo-go-hessian2"
)
regConf := &config.RegistryConfig{
  Protocol:  "zookeeper",
  Timeout:   "3s",
  Group:     "zk_srver_admin",
  Namespace: "zk_srver",
  Address:   "xxxx:2181,xxxx1:2181,xxxx2:2181,xxx3:2181,xxxx4:2181",
  RegistryType: "interface",
}
refConf := config.ReferenceConfig{
  InterfaceName: "com.domain.test.info.api.TestQueryApi",
  Cluster:       "failover",
  Protocol:      dubbo.DUBBO,
  RegistryIDs: []string{"zk"},
  ProvidedBy:  "providers",
  Generic:     "true",
  Version:     "1.0.0",
}
rootConf := config.NewRootConfigBuilder().
  SetApplication(&config.ApplicationConfig{
    Name:  "app_name",
    Owner: "xxxx",
  }).
  AddRegistry("zk", regConf).
  Build()

if err := config.Load(config.WithRootConfig(rootConf)); err != nil {
panic(err)
}

_ = refConf.Init(rootConf)
refConf.GenericLoad("app_name")
resp, err := refConf.GetRPCService().(*generic.GenericService).Invoke(
  context.TODO(),
  "getTestInfo",
  []string{"java.util.List"},
  []hessian.Object{
    []hessian.Object{
        map[string]hessian.Object{"testId": "testId001", "serId": "1710394936000"},
        map[string]hessian.Object{"testId": "testId002", "serId": "1710748418000"},
    },
  },
)

if err != nil {
  panic(err)
}

启动后,有三个 warn 信息

### 1

extension/registry_directory.go:60      registry directory zookeeper does not exist, make sure you have import the package, will use the default directory type.
### 2

tag/router.go:52        [tag router] invokers from previous router is empty.
### 3 error

proxy/proxy.go:212      [CallProxy] received rpc err: Failed to invoke the method $invoke. No provider available for the service dubbo://:@:/?interface=com.domain.test.info.api.TestQueryApi&group=&version=1.0.0 from registry zookeeper://xxxx:2181?registry=zookeeper&registry.group=zk_srver_admin&registry.label=true&registry.namespace=zk_server&registry.preferred=false&registry.role=0&registry.timeout=3s&registry.ttl=15m&registry.weight=0&registry.zone=&remote-client-name=dubbo.registries-zookeeper-xxx%3A2181%2Cxxxx1%3A2181%2Cxxxx2%3A2181%2Cxxxx3%3A2181%2Cxxxx4%3A2181&simplified=false on the consumer xxx.xxx.xxx.xxx using the dubbo version 3.1.1 .Please check if the providers have been started and registered.

还请大佬帮看看是什么问题呢?

tuoxiebushuijiao commented 3 months ago

解决了吗?我也是这个问题