Question

IDE IntelliJ(Java and spring) Error NPA resolve name

  • 19 April 2024
  • 1 reply
  • 45 views

Hello Community,

My developers use the IntelliJ IDE to develop, as our environment is 100% cloud, we use NPA to access the development environments. We use spring as a framework for our applications.

My error is the following for some endpoints I simply cannot connect using IntelliJ and spring. If I do a curl or telnet I can access the endpoint normally, only IntelliJ and spring can't. I have openVPN as redundancy and I don't get this error.

Has anyone had a similar problem?

Below is a simpler application that I can replicate the error

package ConnectivityTest;

import org.springframework.http.ResponseEntity;
import org.springframework.http.client.reactive.ClientHttpConnector;
import org.springframework.http.client.reactive.ReactorClientHttpConnector;
import org.springframework.web.reactive.function.client.ExchangeStrategies;
import org.springframework.web.reactive.function.client.WebClient;
import reactor.netty.http.client.HttpClient;

public class ConnectivityTest {
public static <ObjeresponseEntityct> void main(String[] args) {
HttpClient httpClient = HttpClient.create().wiretap(true); // wiretap(true) é opcional, usado para depuração
ClientHttpConnector connector = new ReactorClientHttpConnector(httpClient);

ExchangeStrategies strategies = ExchangeStrategies.builder()
.codecs(configurer -> configurer.defaultCodecs().maxInMemorySize(1024 * 1024)) // Ajuste o limite de 1MB (1024 * 1024 bytes)
.build();

WebClient client = WebClient.builder()
.clientConnector(connector)
.exchangeStrategies(strategies)
.build();

String url = "https://xxxxxx";

client.get()
.uri(url)
.header("Authorization", "Basic dGVzdDp0ZXN0")
.retrieve()
.toEntity(String.class)
.block(); // Bloqueia a execução até que a resposta seja recebida

ResponseEntity<ObjeresponseEntityct> responseEntity = null;
System.out.println("Response Code: " + responseEntity.getStatusCodeValue());
System.out.println("Response Body: " + responseEntity.getBody());

}
}

 

Caused by: io.netty.resolver.dns.DnsResolveContext$SearchDomainUnknownHostException: Failed to resolve 'xxxxxxx' and search domain query for configured domains failed as well: [bbrouter]
 

 


1 reply

Userlevel 6
Badge +16

Based on first glance it would appear that IDE IntelliJ does not use the default system resolver so that might be causing an issue where NPA cannot intercept the request. This sounds somewhat similar to the behavior you’re encountering:

https://stackoverflow.com/questions/71931899/netty-is-unable-to-resolve-a-dns-name

I’d suggest testing on a single machine to see if changing to a default resolver in the Netty config resolves it.  Otherwise we may need to investigate further. 

Reply