Spring cloud ribbon service name cannot be converted to IP

the service has been registered, as shown in figure

clipboard.png

the service invocation code is as follows:
Startup class:

@SpringCloudApplication
public class RibbonConsumerApplication {

    public static void main(String[] args) {
        SpringApplication.run(RibbonConsumerApplication.class, args);
    }

    @Bean
    @LoadBalanced
    public RestTemplate restTemplate() {
        RestTemplate restTemplate = new RestTemplate();
        return restTemplate;
    }

}

// Controller
@RestController
public class ConsumerController {
    @Autowired
    RestTemplate restTemplate;

    @RequestMapping(value = "/ribbon-consumer", method = RequestMethod.GET)
    public String helloController() {
        String url = "http://HELLOSERVICE/hello";
        ResponseEntity<String> forEntity = restTemplate.getForEntity(url, String.class);
        return forEntity.getBody();
    }

    public String error() {
        return "error";
    }

}

configuration file application.properties
spring.application.name=ribbon-consumer
server.port=9111
eureka.client.service-url.defaultZone= http://localhost:1111/eureka

but always report an error:
java.net.UnknownHostException: HELLOSERVICE

Mar.14,2021

can anyone solve this problem?


I'm in a similar situation, but I'm not sure if it's the same as above, and the exact reason is unknown. The version of spring-boot used by
is 2.1.7 2.0.7-release release, which is downgraded to be resolved.

< H2 > 2.1.7 music release: < / H2 >

eureka Registration:

consumerproviderserver list


debugider/user/1" rel="nofollow noreferrer">http://spring-cloud-provider/...

2.0.7-release:

eureka:

related logs:

2019-02-22 15:44:45.728  INFO 98465 --- [nio-8001-exec-1] c.n.l.DynamicServerListLoadBalancer      : DynamicServerListLoadBalancer for client spring-cloud-provider initialized: DynamicServerListLoadBalancer:{NFLoadBalancer:name=spring-cloud-provider,current list of Servers=[172.17.53.148:8000],Load balancer stats=Zone stats: {defaultzone=[Zone:defaultzone;    Instance count:1;    Active connections count: 0;    Circuit breaker tripped count: 0;    Active connections per server: 0.0;]
},Server stats: [[Server:172.17.53.148:8000;    Zone:defaultZone;    Total Requests:0;    Successive connection failure:0;    Total blackout seconds:0;    Last connection made:Thu Jan 01 08:00:00 CST 1970;    First connection made: Thu Jan 01 08:00:00 CST 1970;    Active Connections:0;    total failure count in last (1000) msecs:0;    average resp time:0.0;    90 percentile resp time:0.0;    95 percentile resp time:0.0;    min resp time:0.0;    max resp time:0.0;    stddev resp time:0.0]
]}ServerList:org.springframework.cloud.netflix.ribbon.eureka.DomainExtractingServerList@132e4091
2019-02-22 15:44:46.679  INFO 98465 --- [erListUpdater-0] c.netflix.config.ChainedDynamicProperty  : Flipping property: spring-cloud-provider.ribbon.ActiveConnectionsLimit to use NEXT property: niws.loadbalancer.availabilityFilteringRule.activeConnectionsLimit = 2147483647
The

call is successful, and it is normal to get the data, current list of Servers= [172.17.53.148, current list of Servers= 8000].

Menu