I am trying to download file from server but getting an error
Checked some solution where i found need to disable the dnsresolver but that also don't work for me.
Here is the code to disable dnsresolver
System.setProperty("vertx.disableDnsResolver", "true");
Source code :-
WebClientOptions webClientOptions = new WebClientOptions() .setSsl(true)
.setTrustAll(true)
.setDefaultPort(443)
.setKeepAlive(true);
WebClient webClient = WebClient.create(vertx,webClientOptions);
final HttpRequest<Buffer> abs = webClient.get("https://downloads.dell.com","/xyz.exe");
abs.send(responseHandler ->{
if (responseHandler.succeeded()){
String temp = vertx.fileSystem().createTempFileBlocking("", "");
vertx.fileSystem().writeFileBlocking(temp, responseHandler.result().body());
routingContext.response().end("Success");
}else{
log.error("Error: {}",responseHandler.cause());
routingContext.response().end("failure");
}
});
Here is an Exception:-
java.net.UnknownHostException: failed to resolve 'https://downloads.dell.com'. Exceeded max queries per resolve 4
at io.netty.resolver.dns.DnsResolveContext.finishResolve(DnsResolveContext.java:927) [netty-resolver-dns-4.1.49.Final.jar:4.1.49.Final]
at io.netty.resolver.dns.DnsResolveContext.tryToFinishResolve(DnsResolveContext.java:886) [netty-resolver-dns-4.1.49.Final.jar:4.1.49.Final]
at io.netty.resolver.dns.DnsResolveContext.query(DnsResolveContext.java:358) [netty-resolver-dns-4.1.49.Final.jar:4.1.49.Final]
at io.netty.resolver.dns.DnsResolveContext.tryToFinishResolve(DnsResolveContext.java:858) [netty-resolver-dns-4.1.49.Final.jar:4.1.49.Final]
at io.netty.resolver.dns.DnsResolveContext.query(DnsResolveContext.java:358) [netty-resolver-dns-4.1.49.Final.jar:4.1.49.Final]
at io.netty.resolver.dns.DnsResolveContext.tryToFinishResolve(DnsResolveContext.java:858) [netty-resolver-dns-4.1.49.Final.jar:4.1.49.Final]
at io.netty.resolver.dns.DnsResolveContext.query(DnsResolveContext.java:358) [netty-resolver-dns-4.1.49.Final.jar:4.1.49.Final]
at io.netty.resolver.dns.DnsResolveContext.tryToFinishResolve(DnsResolveContext.java:858) [netty-resolver-dns-4.1.49.Final.jar:4.1.49.Final]
at io.netty.resolver.dns.DnsResolveContext.query(DnsResolveContext.java:358) [netty-resolver-dns-4.1.49.Final.jar:4.1.49.Final]
at io.netty.resolver.dns.DnsResolveContext.query(DnsResolveContext.java:1001) [netty-resolver-dns-4.1.49.Final.jar:4.1.49.Final]
at io.netty.resolver.dns.DnsResolveContext.tryToFinishResolve(DnsResolveContext.java:878) [netty-resolver-dns-4.1.49.Final.jar:4.1.49.Final]
at io.netty.resolver.dns.DnsResolveContext.query(DnsResolveContext.java:358) [netty-resolver-dns-4.1.49.Final.jar:4.1.49.Final]
at io.netty.resolver.dns.DnsResolveContext.onResponse(DnsResolveContext.java:545) [netty-resolver-dns-4.1.49.Final.jar:4.1.49.Final]
Update :- Using getAbs() I am able to download file around 15 to 20 mb, but In case of file size more than 500mb Not able to download
The
WebClient.get(String, String)
method expects a host name and a path, but you provide a URL as first parameter.If you want to use a URL, use the
WebClient.getAbs(String)
method: