skip to Main Content

I’m upgrading my Spring Boot version from 2.1.x to 2.4.2. When I compiled and run the code, I got the following warning:

Unable to load io.netty.resolver.dns.macos.MacOSDnsServerAddressStreamProvider,fallback to system defaults. This may result in incorrect DNS resolutions on MacOS.
java.lang.ClassNotFoundException: io.netty.resolver.dns.macos.MacOSDnsServerAddressStreamProvider

When I deploy the project to DEV environment which is in AWS and CentOS machine, there is no such warning message in the logs.

Thanks,

8

Answers


  1. For this pull request https://github.com/netty/netty/pull/10848, the log level changes from "debug" to "warn."

    To solve this problem, you can add this dependency:

    <dependency>
        <groupId>io.netty</groupId>
        <artifactId>netty-all</artifactId>
    </dependency>
    
    Login or Signup to reply.
  2. As suggested here, add the following dependency in your module.

    <properties>
      <version.netty>4.1.59.Final</version.netty>
    </properties>
    
    <dependency>
      <groupId>io.netty</groupId>
      <artifactId>netty-resolver-dns-native-macos</artifactId>
      <version>${version.netty}</version>
      <scope>runtime</scope>
      <classifier>osx-x86_64</classifier>
    </dependency>
    

    If you face this issue only while running your app locally on macOS, you may add the dependency for a specific maven profile, e.g. "local".

    <profiles>
      <profile>
        <id>local</id>
        <dependencies>
          <dependency>
            <groupId>io.netty</groupId>
            <artifactId>netty-resolver-dns-native-macos</artifactId>
            <version>${version.netty}</version>
            <scope>runtime</scope>
            <classifier>osx-x86_64</classifier>
          </dependency>
        </dependencies>
      </profile>
    </profiles>
    

    You can avoid specifying version if you import netty-bom in dependencyManagement.

    Login or Signup to reply.
  3. I needed a version in addition to classifier:

        <dependency>
            <groupId>io.netty</groupId>
            <artifactId>netty-resolver-dns-native-macos</artifactId>
            <scope>runtime</scope>
            <classifier>osx-x86_64</classifier>
            <version>4.1.59.Final</version>
        </dependency>
    

    scope is optional but classifier is required.

    For the latest version, see:
    https://mvnrepository.com/artifact/io.netty/netty-resolver-dns-native-macos

    Example: Latest version for M1 macs (aarch_64), as of 2022-01:

    <classifier>osx-aarch_64</classifier>
    <version>4.1.72.Final</version>
    
    Login or Signup to reply.
  4. Gradle syntax if you prefer:

    compile "io.netty:netty-resolver-dns-native-macos:4.1.72.Final:osx-x86_64"
    

    and for ARM-based macbook:

    compile "io.netty:netty-resolver-dns-native-macos:4.1.72.Final:osx-aarch_64"
    
    Login or Signup to reply.
  5. This one is working on my MacBook Pro M1 Pro

    <dependency>
        <groupId>io.netty</groupId>
        <artifactId>netty-all</artifactId>
    </dependency>
    
    Login or Signup to reply.
  6. If you have Gradle and want to include netty only locally you can make use of https://github.com/google/osdetector-gradle-plugin

    plugins {
        id("com.google.osdetector") version "1.7.0"
    }
    
    dependencies {
        if (osdetector.arch.equals("aarch_64")) {
            implementation("io.netty:netty-all")
        }
    }
    
    Login or Signup to reply.
  7. If you are using Intellij and gradle try File->invalidate caches

    implementation("io.netty:netty-all:4.1.75.Final")
    
    Login or Signup to reply.
  8. <dependency>
                    <groupId>io.netty</groupId>
                    <artifactId>netty-resolver-dns-native-macos</artifactId>
                    <version>4.1.72.Final</version>
                    <classifier>osx-aarch_64</classifier>
    </dependency>
    

    it works for me on my M1 pro

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search