diff --git a/service-registry/registry-consul/src/main/java/org/apache/servicecomb/registry/consul/ConsulDiscovery.java b/service-registry/registry-consul/src/main/java/org/apache/servicecomb/registry/consul/ConsulDiscovery.java index 855f2348fd7..c8229ad9ca5 100644 --- a/service-registry/registry-consul/src/main/java/org/apache/servicecomb/registry/consul/ConsulDiscovery.java +++ b/service-registry/registry-consul/src/main/java/org/apache/servicecomb/registry/consul/ConsulDiscovery.java @@ -84,8 +84,11 @@ public List findServiceInstances(String application, St @Override public List findServices(String application) { LOGGER.info("ConsulDiscovery findServices(application={})", application); - Map services = consulClient.agentClient().getServices(); - return Lists.newArrayList(services.keySet()); + Map> response = consulClient.catalogClient().getServices().getResponse(); + if (!CollectionUtils.isEmpty(response)) { + return Lists.newArrayList(response.keySet()); + } + return Lists.newArrayList(); } @Override