Siddharth Siddharth - 1 year ago 206
JSON Question

Caused by: java.lang.ClassNotFoundException: com.fasterxml.jackson.databind.JavaType not found

I am using jackson libs in my application and when I build the code (using ant), the build is successful. And I have tried mock testing by using those methods in unit testing and its working fine. But when starting karaf, it gives me this error:

Caused by: java.lang.ClassNotFoundException: com.fasterxml.jackson.databind.JavaType not found by com.project.test.application [224]
at org.apache.felix.framework.BundleWiringImpl.findClassOrResourceByDelegation(
at org.apache.felix.framework.BundleWiringImpl.access$400(
at org.apache.felix.framework.BundleWiringImpl$BundleClassLoader.loadClass(
at java.lang.ClassLoader.loadClass(

And these are the jars I am downloading in my ivy.xml:

<dependency org="com.fasterxml.jackson.core" name="jackson-core" rev="2.4.4" transitive="false" />
<dependency org="com.fasterxml.jackson.core" name="jackson-annotations" rev="2.4.4" transitive="false" />
<dependency org="com.fasterxml.jackson.core" name="jackson-databind" rev="2.4.4" transitive="false" />

I have tried changing the versions, but still the same error. Do I have to load these jars after downloading? I have kept the default place as ivy-lib and that process is working for all the other jars I am downloading.
What is going wrong? Does this require a specific version or any other dependency? Or is there other way to load these jar files?

My classpath in build.xml

<path id="compile.classpath">
<fileset dir="${ivy.lib}">
<include name="*.jar"/>

Answer Source

I was getting this error because someone else in some other class was using org.codehaus.jackson package and I am using com.fasterxml.jackson package. And because of this conflict of jars, it was throwing this ClassNotFoundException. Once I removed and replaced those fasterxml jars with codehaus jars, it started working fine.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download