1

I'm trying to use Jackson for converting string to JSON object in java. I have both jar file and maven project of the library, with which I tried one by one but both giving error while calling writeValue function. Error says -

The type com.fasterxml.jackson.core.JsonGenerator cannot be resolved. It is indirectly referenced from required .class files

I have correctly added the library to build path. After looking at eclipse-error-indirectly-referenced-from-required-class-files ,I realized that the problem is because of missing com.fasterxml.jackson.core.JsonGenerator class file.So Which jar file I missed to add to build path?. Tried by adding the maven project on build path too- same error.

Community
  • 1
  • 1
The_ehT
  • 1,202
  • 17
  • 32

3 Answers3

2

Make sure that you have in your path jackson-databind and jackson-core

anquegi
  • 11,125
  • 4
  • 51
  • 67
  • I have jackson core also added, but there is no class called `com.fasterxml.jackson.core.JsonGenerator` to import. – The_ehT May 28 '15 at 12:48
2

To find which jar contains the required file, you can always use http://search.maven.org and search for the class prefixing it with fc:, like this:

http://search.maven.org/#search%7Cga%7C1%7Cfc%3Acom.fasterxml.jackson.core.JsonGenerator

Looks like you're missing jackson-core jar on your classpath.

Forketyfork
  • 7,416
  • 1
  • 26
  • 33
  • thanks after searching I found out that jackson-core has class `jackson-core` but when I tried to import `com.fasterxml.jackson.core.JsonGenerator` , it din't show up. – The_ehT May 28 '15 at 12:50
  • Did you add jackson-core to your maven `dependencies`? Under Eclipse you probably need to refresh the maven configuration or rebuild the project. – Forketyfork May 28 '15 at 12:53
0

build path is used during compile. You need to set up the Deployment Assembly for run time classpath (under project settings, look for Deployment Assembly )

Sharon Ben Asher
  • 13,849
  • 5
  • 33
  • 47