Skip to content
Advertisement

The package com.fasterxml.jackson.databind is not accessible Java (268436910)

I have recently explored handling JSON data with the org.json library and all went well. Now I started a bigger Maven project, for which I intend to use the Jackson libraries in stead. Sadly, it does not seem to work for me. I wanted to try out the ObjectMapper class, that VScode autocompleted for me, which also automatically adds the required import:

JavaScript

However, I also immediately get an error on that line: “The type com.fasterxml.jackson.databind.ObjectMapper is not accessible Java (16778666)

I have added the necessary dependencies to my pom.xml file like so:

JavaScript

Am I missing something? Are there any other steps that I should have taken?

Advertisement

Answer

The only dependency needed for ObjectMapper is

JavaScript

This error occurs, because Jackson library is not included in your project’s classpath. Probably your project is using the Java Platform Module System (JPMS); then log would also contain:

… declared in the “unnamed module” … module does not read it.

If this is the case, add a requires directive to module-info.java file to specify that this module requires the jackson-databind library:

JavaScript

After adding this requires directive recompile the project again.

User contributions licensed under: CC BY-SA
10 People found this is helpful
Advertisement