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"
So I was using jackson-databind
version 2.18.0
and Eclipse did not find module-info.class
in the jar. Downgrade to 2.17.2
solved the issue.
Apparently I am not the first one to encounter this issue.