0

I have a Scala sbt project which I am trying to run on my IntelliJ but I am facing exception as:

Exception in thread "main" java.lang.NoClassDefFoundError: com/fasterxml/jackson/databind/Module

I have included the dependency in my build.sbt as

libraryDependencies += "com.fasterxml.jackson.core" % "jackson-databind" % "2.12.1" 

Can someone let me know what is missing?

I also thought may be it needs some dependency related to scala so I added though I am not sure of this but still same error

// https://mvnrepository.com/artifact/com.fasterxml.jackson.module/jackson-module-scala
libraryDependencies += "com.fasterxml.jackson.module" %% "jackson-module-scala" % "2.12.3"

Any suggestions anyone?

2 Answers2

0

This Error is happened when your code depends on some class ( in your case jackson.databind.Module) but java cannot find it when trying to compile because dependency address is not passed to Java as argument, if you have added the proper dependencies in your build.sbt file, try this in IntelliJ:

sbt reload (in your application terminal or sbt shell)
File > Invalidate cache and restart

Just updates the project and indexes the project and dependencies so updates the compile and running command, which might fix your problem.

AminMal
  • 3,070
  • 2
  • 6
  • 15
-1

Resolved by adding

dependencyOverrides += "com.fasterxml.jackson.core" % "jackson-core" % "2.10.5"
dependencyOverrides += "com.fasterxml.jackson.core" % "jackson-databind" % "2.10.5"
dependencyOverrides += "com.fasterxml.jackson.module" %% "jackson-module-scala" % "2.10.5"

to build.sbt file.