0

We have a CompanyTokenValidation class with this code:

return this.defaultWebClient.get()
        .uri(uriBuilder -> uriBuilder
                .path(tokenValidationUri)
                .build())
        .header(HttpHeaders.AUTHORIZATION, bearerToken)
        .retrieve()
        .bodyToMono(JsonNode.class)
        .block();

And uriBuilder goes to old IP, printing this trace:

reactor.core.Exceptions$ReactiveException: io.netty.channel.ConnectTimeoutException: connection timed out: /XXX.XXX.XX.51:8082
    at reactor.core.Exceptions.propagate(Exceptions.java:393)
    at reactor.core.publisher.BlockingSingleSubscriber.blockingGet(BlockingSingleSubscriber.java:97)
    at reactor.core.publisher.Mono.block(Mono.java:1680)
    at com.company.web.validations.CompanyTokenValidation.validate(CompanyTokenValidation.java:44)
    at com.company.web.validations.validators.Validator.validate(Validator.java:38)

We restart tomcat four times to put logs, and always goes to old IP. ¿Is a problem in uriBuilder Spiing injetion?

I'm completely lost. We always work with DNS names like city-51.company.com in our yml or properties.

Corporativo
  • 185
  • 1
  • 2
  • 11
  • 1
    It's always DNS. DNS entries are frequently cached at various places (on the remote server end, locally, ...). That's why they have a TTL. How long ago was the IP changed? What's the TTL of the entry? If this is the issue then it has nothing to do with Java itself or UriBuilder. – Joachim Sauer Aug 04 '22 at 08:49
  • IP change yesterday and I don't know what is TTL. – Corporativo Aug 04 '22 at 09:48
  • 1
    TTL is "time to live". Simply speaking is how long DNS entries are okay to be cached. Does resolving the host name on the server directly (using `nslookup` or `dig` or even just `ping`) show the new IP? – Joachim Sauer Aug 04 '22 at 09:54
  • OK for TTL. With ping from my PC show the new IP since it changed. Thanks. – Corporativo Aug 04 '22 at 10:19

0 Answers0