nacos-group / nacos-examples

Nacos Examples
Apache License 2.0
951 stars 1.47k forks source link

nacos-spring-boot-discovery-example 注册服务异常 #13

Open licoco opened 5 years ago

licoco commented 5 years ago

@NacosInjected private NamingService namingService;

@PostConstruct public void registerInstance() throws NacosException, UnknownHostException { namingService.registerInstance(applicationName, InetAddress.getLocalHost().getHostAddress(), serverPort,"DEFAULT"); }

通过NamingService 对象来调用注册而不是 Nacos Open API 来注册会失败,请问下是什么 原因

NamingService 也是调用这个接口,参数会生成一些默认填充??

thank037 commented 5 years ago

@licoco com.alibaba.nacos.client.naming.net.NamingProxy#registerService

 params.put("cluster", JSON.toJSONString(instance.getCluster()));

这个参数400 bad request

peterTao0506 commented 5 years ago

请参考我提的issue,将依赖调整一下 `

com.alibaba.boot nacos-discovery-spring-boot-starter 0.2.1 com.alibaba.nacos nacos-client
    <dependency>

        <groupId>com.alibaba.nacos</groupId>

        <artifactId>nacos-client</artifactId>

        <version>0.6.2</version>

    </dependency>

`

huangsanyeah commented 3 years ago

改完了还是不行啊

peterTao0506 commented 2 years ago

debug一下,可以看到每一步变量的值。

在 2021-08-24 19:01:53,"huangsanyeah" @.***> 写道:

改完了还是不行啊

— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or unsubscribe. Triage notifications on the go with GitHub Mobile for iOS or Android.