apache / shenyu

Apache ShenYu is a Java native API Gateway for service proxy, protocol conversion and API governance.
https://shenyu.apache.org/
Apache License 2.0
8.45k stars 2.93k forks source link

Gateway local deployment usage problem(2.4.0) #1901

Closed zhentaowang closed 3 years ago

zhentaowang commented 3 years ago

Describe the bug

Pull the latest code from GitHub, compile and start locally, and write a spring cloud demo, Nacos for the registry

When I request the demo API through the gateway, the following error is reported:

{

"code": -109,

"message": "SpringCloud serviceId does not exist or is configured incorrectly!",

"data": null

}

Environment

Steps to reproduce

Expected behavior

But after analysis, I don't know why I didn't find the demo service. I forgot to take the time to help me see when the latest 2.4.0 release will be released

Debug logs

During preliminary troubleshooting, it is found that there is no service in the service list of ribbon load balancer, and the log is as follows:

2021-08-06 15:51:31 [shenyu-netty-kqueue-2] INFO com.netflix.config.ChainedDynamicProperty - Flipping property: demo.ribbon.ActiveConnectionsLimit to use NEXT property: niws.loadbalancer.availabilityFilteringRule.activeConnectionsLimit = 2147483647

2021-08-06 15:51:31 [shenyu-netty-kqueue-2] INFO com.netflix.loadbalancer.BaseLoadBalancer - Client: demo instantiated a LoadBalancer: DynamicServerListLoadBalancer:{NFLoadBalancer:name=demo,current list of Servers=[],Load balancer stats=Zone stats: {},Server stats: []}ServerList:null

2021-08-06 15:51:31 [shenyu-netty-kqueue-2] INFO com.netflix.loadbalancer.DynamicServerListLoadBalancer - Using serverListUpdater PollingServerListUpdater

2021-08-06 15:51:31 [shenyu-netty-kqueue-2] INFO com.netflix.loadbalancer.DynamicServerListLoadBalancer - DynamicServerListLoadBalancer for client demo initialized: DynamicServerListLoadBalancer:{NFLoadBalancer:name=demo,current list of Servers=[],Load balancer stats=Zone stats: {}, Server stats: []}ServerList:com.alibaba.cloud.nacos.ribbon. NacosServerList@aa91946

15:51:46,369 |-INFO in ReconfigureOnChangeTask(born:1628236246363) - Empty watch file list. Disabling

Click to expand ``` replace this line with your debug logs ```
yu199195 commented 3 years ago

can you see this : https://shenyu.apache.org/zh/projects/shenyu/spring-cloud-proxy/

Maybe you're missing the dependency~

zhentaowang commented 3 years ago

thk, this bug is solved when nacos discovery version chang to 2.1.0.RELEASE, the version 2.2.5.RELEASE can incompatible

zhentaowang commented 3 years ago

Other, when the gateway service and business service are not registered under the same namespace of Nacos, the following error will occur: {

"code": -109,

"message": "SpringCloud serviceId does not exist or is configured incorrectly!",

"data": null

}

yu199195 commented 3 years ago

when the gateway service and business service are not registered under the same namespace of Nacos

so you can register the same namespace

zhentaowang commented 3 years ago

yes