Search code examples
kotlinktor

java.lang.NoClassDefFoundError: com/fasterxml/jackson/databind/JsonDeserializer


I'm building a server side application in Kotlin, using the Ktor framework. When I run the application, I receive a NoClassDefFoundError. The stacktrace is shown below:

Caused by: java.lang.NoClassDefFoundError: com/fasterxml/jackson/databind/JsonDeserializer
    at com.auth0.jwt.JWTVerifier.<init>(JWTVerifier.java:28)
    at com.auth0.jwt.JWTVerifier$BaseVerification.build(JWTVerifier.java:316)
    at com.auth0.jwt.JWTVerifier$BaseVerification.build(JWTVerifier.java:304)
    at com.example.auth.JwtService.<init>(JwtService.kt:18)
    at com.example.ApplicationKt.module(Application.kt:44)

It seems to point to something to do with my verifier variable shown below in my JWTVerifier class.

val verifier: JWTVerifier = JWT
        .require(algorithm)
        .withIssuer(issuer)
        .build()

Help would be most appreciated.


Solution

  • I had the same issue.

    My project was running without issues (before Sept 15) and i haven't updated any dependencies. Then it started crashing with Caused by: java.lang.NoClassDefFoundError: com/fasterxml/jackson/databind/JsonDeserializer

    What fixed it was updating Ktor. I was using version 1.5.4 and updated to 1.6.3