Netty IO Channel No Such Method Error
Jun 13, 2024
If you are facing the below error out of nowhere (generally when you update your dependency versions or add a new dependency) then it is mostly the result of multiple versions of “io.netty.channel”.
java.lang.NoSuchMethodError: 'io.netty.channel.DefaultChannelId io.netty.channel.DefaultChannelId.newInstance()'
This can be easily fixed by adding an exclusion on the new or updated dependency to not include “netty-nio-client” which I did for the AWS SDK in maven.
<dependency>
<groupId>software.amazon.awssdk</groupId>
<artifactId>sqs</artifactId>
<exclusions>
<exclusion>
<groupId>software.amazon.awssdk</groupId>
<artifactId>netty-nio-client</artifactId>
</exclusion>
</exclusions>
</dependency>
I faced this issue when adding AWS SDK to an old Scala service.