HMT
HMT

Reputation: 2271

ResourceAccessException when trying to execute a post service

I am getting this exception org.springframework.web.client.ResourceAccessException I/O error on POST request for \"http://host.docker.internal:8073/user-management/users/login\": Connection timed out: connect; nested exception is java.net.ConnectException: Connection timed out: connect", My code looks like this

@Resource(name="restTemp")
    private RestTemplate restTemplate;

String url = "user-management/users/login";
        //String fullUrl = "https://localhost:8073/user-management/users/login";
        InstanceInfo instance = eurekaClient.getNextServerFromEureka("user-management", false);
        LoginRequest user =  restTemplate.postForObject(instance.getHomePageUrl()+url, loginRequest, LoginRequest.class);

Also I dont understand why instance.getHomePageUrl() generates a internal docker url . what could be the reason behind this docker desktop is running. I need help in resolving this exception.According to what I could find this exception occurs when we are trying to access a third party url

Upvotes: 1

Views: 4275

Answers (1)

iron_man
iron_man

Reputation: 533

Just try increasing the context timeout for request sent by RestTemplate

Upvotes: 1

Related Questions