Suman Kumar
Suman Kumar

Reputation: 21

java.lang.ClassNotFoundException: io.netty.handler.logging.ByteBufFormat

I'm on integrating a third-party library into our application. For that I have added all the dependencies, however facing below error stack on application run.

Error stack-trace: `

Caused by: java.lang.ClassNotFoundException: io.netty.handler.logging.ByteBufFormat
    at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:581)
    at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178)
    at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521)
    ... 31 common frames omitted

`

Maven dependencies:

`

<dependency>
    <groupId>com.affinda.api</groupId>
    <artifactId>affinda-api-client</artifactId>
    <version>0.4.2</version>
</dependency>
<dependency>
    <groupId>com.microsoft.rest</groupId>
    <artifactId>client-runtime</artifactId>
    <version>1.7.14</version>
</dependency>
<dependency>
    <groupId>com.microsoft.azure</groupId>
    <artifactId>azure-client-runtime</artifactId>
    <version>1.7.14</version>
</dependency>
<dependency>
    <groupId>com.microsoft.azure</groupId>
    <artifactId>azure-client-authentication</artifactId>
    <version>1.7.14</version>
</dependency>
<dependency>
    <groupId>com.azure</groupId>
    <artifactId>azure-identity</artifactId>
    <version>1.5.0</version>
</dependency>
<dependency>
    <groupId>io.netty</groupId>
    <artifactId>netty-all</artifactId>
    <version>4.1.84.Final</version>
</dependency>
<dependency>
    <groupId>io.netty</groupId>
    <artifactId>netty-handler</artifactId>
    <version>4.1.84.Final</version>
</dependency>

`

I did check that ByteBufFormat is in netty-handler library from the docs and did check the dependency tree but haven't got any clue.

Upvotes: 2

Views: 6796

Answers (1)

Corzar
Corzar

Reputation: 43

It might be too late, however I had the same problem. The cause is that another dependency is overriding the netty version in your final pom. In my case it was spring boot dependencies (2.2.0-RELEASE) which was overriding netty to version 4.1.42Final instead of needed 4.1.86Final. If you want to check who is responsible, you can run maven with goal help:effective-pom and search for the effective netty version management owner. In order to solve the issue you can just specify the netty version among maven properties:

<properties>
    .
    .
    <netty.version>4.1.86.Final</netty.version>
</properties>

In this way you will put back the expected netty version and everything will work like a charm. Be careful to check that the other library is still working as well.

Upvotes: 3

Related Questions