Spring Boot 2.4.2 - Redisson Client - DNS Resolution Problem at start

I'm upgrading my Spring Boot version from 2.1.x to 2.4.2 and using Redisson as Redis Client in the project. 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

However, my code continues to run and to use Redis in my machine. When I deploy the project to DEV environment which is in AWS and CentOS machine, there is no such warning message in the logs. I suspect that there is an incompatibility issue between Spring Boot and Redisson in MacBook when resolving DNS for Redis because when I downgraded Spring Boot to 2.4.1, no warning messages occurred.

Thanks,


Solution 1:

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>

Solution 2:

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>

Solution 3:

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"

Solution 4:

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.