Using this code :
import org.codehaus.jackson.map.ObjectMapper;
ObjectMapper objectMapper = new ObjectMapper();
String str = objectMapper.writeValueAsString(myObject);
I receive this Eclipse error:
The type org.codehaus.jackson.JsonGenerationException cannot be resolved. It is indirectly referenced from
required .class files
at line String str = objectMapper.writeValueAsString(myObject);
There are three 'JsonGenerationException' class types on my class path (you may have to save the image and open it separately to read the text in the image):
Is the reason I'm receiving this error message because JsonGenerationException is in two different jar files and Eclipse is unsure which on to use ? If so how can I fix it ?
I required this jar file : http://grepcode.com/snapshot/repo1.maven.org/maven2/org.codehaus.jackson/jackson-core-asl/1.9.4
import org.codehaus.jackson.map.ObjectMapper;
and also,you have to add jackson-core-asl-XXX.jar
to build path.
Make sure that the JAR containing org.codehaus.jackson.JsonGenerationException
is on your classpath, e.g., by using jackson-core-asl POM.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With