0

I have a Spring Boot service that has registered some methods with ZooKeeper through Dubbo, and here is the configuration file for that service.

spring:
  cloud:
    zookeeper:
      connect-string: 12.79.17.16:2186
      discovery:
        enabled: true
dubbo:
  application:
    name: dubbo-${spring.application.name}
    qos-enable: false
    metadata-type: remote
  protocol:
    name: dubbo
    port: 20882
    ssl-enabled: true
  registry:
    address: zookeeper://${spring.cloud.zookeeper.connect-string}
    timeout: 25000
    parameters:
      blockUntilConnectedWait: 250
      namespace: dms-local
  provider:
    filter: dubboTraceFilter,dmsUserProviderFilter
  consumer:
    filter: dubboTraceFilter,dmsUserConsumerFilter
    timeout: 4000
    check: false
  metadata-report:
    address: zookeeper://${spring.cloud.zookeeper.connect-string}

and now, I want to use dubbo-go as client to call these methods, here is my dubbo-go configuration.

dubbo:
  registries:
    demoZK:
      protocol: zookeeper
      timeout: 3s
      address: 12.79.17.16:2186
      username: dms
      password: p-QXraCdR0y6FoX9D
  consumer:
    references:
      SystemConfigService:
        protocol: dubbo 
        interface: cn.ctyun.dms.console.api.dubbo.service.SystemConfigService

here is the client code with golang.

package main

import(
    "context"
    _ "dubbo.apache.org/dubbo-go/v3/imports"
    "dubbo.apache.org/dubbo-go/v3/config"
    "github.com/dubbogo/gost/log/logger"
)

var (
    systemConfigService = &SystemConfigService{}
)

type SystemConfigService struct {
  GetConfig  func(ctx context.Context, req string) (*SystemConfigDTO, error) `dubbo:"getConfig"` 
}

func init(){
    config.SetConsumerService(systemConfigService)
}

func main(){
    config.Load()
    var i string = "hello"
    config, err := systemConfigService.GetConfig(context.TODO(), i)
    if err != nil {
        panic(err)
    }
    logger.Infof("response result: %v", config)
  }

but when I execute go run, the console gives me the following error:

2024-06-11 11:56:53     INFO    logger/logging.go:42    The following profiles are active: [default]
2024-06-11 11:56:53     INFO    config/root_config.go:137       [Config Center] Config center doesn't start
2024-06-11 11:56:53     INFO    zookeeper/client.go:53  [Zookeeper Client] New zookeeper client with name = 12.79.17.16:2186, zkAddress = 12.79.17.16:2186, timeout = 5s
2024/06/11 11:56:54 Connected to 12.79.17.16:2186
2024/06/11 11:56:54 Connected to 12.79.17.16:2186
2024/06/11 11:56:54 Authenticated: id=72057596006959104, timeout=5000
2024/06/11 11:56:54 Re-submitting `0` credentials after reconnect
2024/06/11 11:56:54 Authenticated: id=72057596006959105, timeout=4000
2024/06/11 11:56:54 Re-submitting `0` credentials after reconnect
2024-06-11 11:56:54     ERROR   zookeeper/service_discovery.go:177      [zkServiceDiscovery] Could not query the instances for service{dubbo.io}, error = err{Error while invoking zk.Children(path:/services/dubbo.io), the reason maybe is: : zk: node does not exist} 
2024-06-11 11:56:54     INFO    zookeeper/client.go:53  [Zookeeper Client] New zookeeper client with name = 12.79.17.16:2186, zkAddress = 12.79.17.16:2186, timeout = 5s
2024-06-11 11:56:55     INFO    servicediscovery/service_discovery_registry.go:235      Synchronized instance notification on subscription, instance list size %!s(int=1)
2024-06-11 11:56:55     INFO    servicediscovery/service_instances_changed_listener_impl.go:71  Received instance notification event of service dubbo-dms-console, instance list size %!s(int=1)
2024-06-11 11:56:55     WARN    delegate/delegate_report.go:113 the metadataReport URL is not configured, you should configure it.
2024-06-11 11:56:55     WARN    servicediscovery/service_discovery_registry.go:241      [ServiceDiscoveryRegistry] ServiceInstancesChangedListenerImpl handle error:the metadataReport URL is not configured, you should configure it.
2024-06-11 11:56:55     INFO    zookeeper/listener.go:463       [Zookeeper Listener] listen dubbo path{/services/dubbo-dms-console}
2024-06-11 11:56:55     INFO    servicediscovery/service_instances_changed_listener_impl.go:71  Received instance notification event of service dubbo-dms-console, instance list size %!s(int=1)
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x18 pc=0x15ad334]

goroutine 30 [running]:
dubbo.apache.org/dubbo-go/v3/registry/servicediscovery.GetMetadataInfo({0x1ed0060, 0xc000368320}, {0xc0005d4ac0, 0x20})
        /go/pkg/mod/dubbo.apache.org/dubbo-go/[email protected]/registry/servicediscovery/service_instances_changed_listener_impl.go:202 +0x94
dubbo.apache.org/dubbo-go/v3/registry/servicediscovery.(*ServiceInstancesChangedListenerImpl).OnEvent(0xc000709140, {0x1eb95a0?, 0xc0002f0550})
        /go/pkg/mod/dubbo.apache.org/dubbo-go/[email protected]/registry/servicediscovery/service_instances_changed_listener_impl.go:91 +0x72e
dubbo.apache.org/dubbo-go/v3/registry/zookeeper.(*zookeeperServiceDiscovery).DataChange(0xc000150070, {{0xc0003a64e0, 0x2e}, 0x0, {0xc0001d0d80, 0x203}})
        /go/pkg/mod/dubbo.apache.org/dubbo-go/[email protected]/registry/zookeeper/service_discovery.go:277 +0x303
dubbo.apache.org/dubbo-go/v3/remoting/zookeeper.(*ZkEventListener).listenDirEvent(0xc000708450, 0x0, {0xc0005d46a0, 0x1b}, {0x1e9d740, 0xc000150070}, {0x0, 0x0})
        /go/pkg/mod/dubbo.apache.org/dubbo-go/[email protected]/remoting/zookeeper/listener.go:396 +0xb7a
dubbo.apache.org/dubbo-go/v3/remoting/zookeeper.(*ZkEventListener).ListenServiceEvent.func1({0xc0005d46a0, 0x1b}, {0x1e9d740?, 0xc000150070?})
        /go/pkg/mod/dubbo.apache.org/dubbo-go/[email protected]/remoting/zookeeper/listener.go:470 +0xb1
created by dubbo.apache.org/dubbo-go/v3/remoting/zookeeper.(*ZkEventListener).ListenServiceEvent in goroutine 29
        /go/pkg/mod/dubbo.apache.org/dubbo-go/[email protected]/remoting/zookeeper/listener.go:465 +0x17c
exit status 2

I tried to modify every config, but I cannot call Java methods successfully, so what can I do for it?

0