October 25, 2024
Chicago 12, Melborne City, USA
java

Java: Need to read jackson.databind module, but it does not exist


I have a class MyClass inside java module com.example.mymodule, which needs to use com.fasterxml.jackson.databind.ObjectMapper.

When trying to run the app, I get the following error:

java.lang.IllegalAccessError: class com.example.MyClass (in module com.example.mymodule) cannot access class com.fasterxml.jackson.databind.ObjectMapper (in module com.fasterxml.jackson.databind) because module com.example.mymodule does not read module com.fasterxml.jackson.databind

I tried adding requires com.fasterxml.jackson.databind; into mymodule, but then I get the error "com.fasterxml.jackson.databind cannot be resolved to a module".

I am using Maven and I have the latest jackson-databind:2.18.0 in my dependencies. The jar itself doesn’t contain module-info.java.

I also tried using requires jackson.databind; but then I get error:

java.lang.module.FindException: Module jackson.databind not found, required by com.example.mymodule"



You need to sign in to view this answers

Leave feedback about this

  • Quality
  • Price
  • Service

PROS

+
Add Field

CONS

+
Add Field
Choose Image
Choose Video