Unable to load io.netty.resolver.dns.macos.MacOSDnsServerAddressStreamProvider
1 min readMay 9, 2022
Problem
MacBook Pro (14-inch, 2021) Chip : Apple M1 Pro
Kotlin version : 1.6.20
Found issue when trying to run or use library `io.netty` will caught error
SEVERE: Unable to load io.netty.resolver.dns.macos.MacOSDnsServerAddressStreamProvider, fallback to system defaults. This may result in incorrect DNS resolutions on MacOS.
java.lang.reflect.InvocationTargetException
at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:490)
at io.netty.resolver.dns.DnsServerAddressStreamProviders.<clinit>(DnsServerAddressStreamProviders.java:64)
at io.netty.resolver.dns.DnsNameResolverBuilder.<init>(DnsNameResolverBuilder.java:60)
at reactor.netty.transport.NameResolverProvider.newNameResolverGroup(NameResolverProvider.java:432)
at reactor.netty.tcp.TcpResources.getOrCreateDefaultResolver(TcpResources.java:305)
at reactor.netty.http.HttpResources.getOrCreateDefaultResolver(HttpResources.java:139)
at reactor.netty.http.client.HttpClientConfig.defaultAddressResolverGroup(HttpClientConfig.java:382)
at reactor.netty.transport.ClientTransportConfig.resolverInternal(ClientTransportConfig.java:223)
at reactor.netty.http.client.HttpClientConfig.resolverInternal(HttpClientConfig.java:436)
at reactor.netty.http.client.HttpClientConnect$MonoHttpConnect.lambda$subscribe$0(HttpClientConnect.java:264)
at reactor.core.publisher.MonoCreate.subscribe(MonoCreate.java:57)
at reactor.core.publisher.FluxRetryWhen.subscribe(FluxRetryWhen.java:77)
at reactor.core.publisher.MonoRetryWhen.subscribeOrReturn(MonoRetryWhen.java:46)
at reactor.core.publisher.InternalMonoOperator.subscribe(InternalMonoOperator.java:57)
at reactor.netty.http.client.HttpClientConnect$MonoHttpConnect.subscribe(HttpClientConnect.java:271)
at reactor.core.publisher.InternalMonoOperator.subscribe(InternalMonoOperator.java:64)
at reactor.core.publisher.MonoDefer.subscribe(MonoDefer.java:52)
at reactor.core.publisher.Mono.subscribe(Mono.java:4361)
at kotlinx.coroutines.reactive.AwaitKt.awaitOne(Await.kt:190)
at kotlinx.coroutines.reactive.AwaitKt.awaitOne$default(Await.kt:183)
at kotlinx.coroutines.reactive.AwaitKt.awaitSingle(Await.kt:81)
at com.expediagroup.graphql.client.spring.GraphQLWebClient.execute$suspendImpl(GraphQLWebClient.kt:47)
at com.expediagroup.graphql.client.spring.GraphQLWebClient.execute(GraphQLWebClient.kt)
at com.expediagroup.graphql.client.GraphQLClient$DefaultImpls.execute$default(GraphQLClient.kt:30)
at com.me.graphql.MainKt$main$1.invokeSuspend(Main.kt:12)
at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106)
at kotlinx.coroutines.EventLoopImplBase.processNextEvent(EventLoop.common.kt:274)
at kotlinx.coroutines.BlockingCoroutine.joinBlocking(Builders.kt:85)
at kotlinx.coroutines.BuildersKt__BuildersKt.runBlocking(Builders.kt:59)
at kotlinx.coroutines.BuildersKt.runBlocking(Unknown Source)
at kotlinx.coroutines.BuildersKt__BuildersKt.runBlocking$default(Builders.kt:38)
at kotlinx.coroutines.BuildersKt.runBlocking$default(Unknown Source)
at com.me.graphql.MainKt.main(Main.kt:10)
at com.me.graphql.MainKt.main(Main.kt)
Caused by: java.lang.UnsatisfiedLinkError: 'io.netty.resolver.dns.macos.DnsResolver[] io.netty.resolver.dns.macos.MacOSDnsServerAddressStreamProvider.resolvers()'
at io.netty.resolver.dns.macos.MacOSDnsServerAddressStreamProvider.resolvers(Native Method)
at io.netty.resolver.dns.macos.MacOSDnsServerAddressStreamProvider.retrieveCurrentMappings(MacOSDnsServerAddressStreamProvider.java:127)
at io.netty.resolver.dns.macos.MacOSDnsServerAddressStreamProvider.<init>(MacOSDnsServerAddressStreamProvider.java:123)
... 38 more
Solution
Append this library
gradle build
runtimeOnly("io.netty:netty-resolver-dns-native-macos:4.1.76.Final:osx-aarch_64")
maven build
<dependency>
<groupId>io.netty</groupId>
<artifactId>netty-resolver-dns-native-macos</artifactId>
<version>4.1.76.Final</version>
<classifier>osx-aarch_64</classifier>
</dependency>
reference : https://github.com/netty/netty/issues/11020