[java] java.lang.NoClassDefFoundError: com/fasterxml/jackson/core/JsonFactory

I am working on YouTube broadcast sample examples. I have created a sample Java Project & added required jars. But, when I try to run the project it throws exception.

Exception :

Throwable: com/fasterxml/jackson/core/JsonFactory
java.lang.NoClassDefFoundError: com/fasterxml/jackson/core/JsonFactory
    at com.google.api.client.json.jackson2.JacksonFactory.<init>(JacksonFactory.java:44)
    at com.google.api.services.samples.youtube.cmdline.live.Auth.<clinit>(Auth.java:35)
    at com.google.api.services.samples.youtube.cmdline.live.CreateBroadcast.main(CreateBroadcast.java:55)
Caused by: java.lang.ClassNotFoundException: com.fasterxml.jackson.core.JsonFactory
    at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
    at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:425)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
    ... 3 more

I downloaded the project from this GitHub repository.

The answer is


If you are using springboot then jackson is added by default,

So the version of jackson you are adding manualy is probably conflicting with the one spring boot adds,

Try to delete the jackson dependencies from your pom,

If you need to override the version spring boots add, then you need to exclude it first and then add your own


In my case problem was when i added com.fasterxml.jackson.dataformat i put the version 2.11.0.

While all other Jackson dependencies were 2.8.0 and one of them was 2.11.0 and changing all to be 2.8.0 fixed it.

FYI, 2.11 is the latest but due to my legacy code, i kept it as 2.8 as well.

Before Fix [ERROR]

com.fasterxml.jackson.dataformat version is 2.11.0    
com.fasterxml.jackson.dataformat jackson-dataformat-xml 2.11.0
<dependency>
    <groupId>com.fasterxml.jackson.core</groupId>
    <artifactId>jackson-core</artifactId>
    <version>2.8.0</version>
</dependency>

<dependency>
    <groupId>com.fasterxml.jackson.core</groupId>
    <artifactId>jackson-databind</artifactId>
    <version>2.8.0</version>
</dependency>

<dependency>
    <groupId>com.fasterxml.jackson.core</groupId>
    <artifactId>jackson-annotations</artifactId>
    <version>2.8.0</version>
</dependency>

After Fix [WORKED] com.fasterxml.jackson.dataformat version is 2.8.0

com.fasterxml.jackson.dataformat jackson-dataformat-xml 2.8.0
<dependency>
    <groupId>com.fasterxml.jackson.core</groupId>
    <artifactId>jackson-core</artifactId>
    <version>2.8.0</version>
</dependency>

<dependency>
    <groupId>com.fasterxml.jackson.core</groupId>
    <artifactId>jackson-databind</artifactId>
    <version>2.8.0</version>
</dependency>

<dependency>
    <groupId>com.fasterxml.jackson.core</groupId>
    <artifactId>jackson-annotations</artifactId>
    <version>2.8.0</version>
</dependency>

As of jackson 2.7.4 (or earlier maybe), the class is in jacskon-jaxrs-base.jar, which is contained in jackson-jaxrs-json-provider


I have had the same error. I added dependency on pom.xml (I am working with Maven)

<dependency> 
        <groupId>com.fasterxml.jackson.core</groupId> 
        <artifactId>jackson-core</artifactId> 
        <version>2.12.1</version> 
 </dependency> 

I started trying with version 2.9.0, then I found a different error (com/fasterxml/jackson/core/exc/InputCoercionException) then I try different versions until all errors were solved with version 2.12.1


Because of old version I got this error. Then I changed to this version n error gone Using maven my pom.xml

<properties>  
    ...
    <jackson.version>2.5.2</jackson.version>
</properties>

<dependencies>
...
        <dependency>
            <groupId>com.fasterxml.jackson.core</groupId>
            <artifactId>jackson-core</artifactId>
            <version>${jackson.version}</version>
        </dependency>
        <dependency>
            <groupId>com.fasterxml.jackson.core</groupId>
            <artifactId>jackson-databind</artifactId>
            <version>${jackson.version}</version>
        </dependency>
        <dependency>
            <groupId>com.fasterxml.jackson.core</groupId>
            <artifactId>jackson-annotations</artifactId>
            <version>${jackson.version}</version>
        </dependency>
</dependencies>

my old version was '2.2.3'


The requested jar is probably not jackson-annotations-x.y.z.jar but jackson-core-x.y.z.jar which could be found here: http://www.java2s.com/Code/Jar/j/Downloadjacksoncore220rc1jar.htm


Solved the problem by upgrading the dependency to below version

<dependency>
    <groupId>com.fasterxml.jackson.core</groupId>
    <artifactId>jackson-core</artifactId>
    <version>2.9.8</version>
</dependency>

You have to add one jar : jackson-annotations-2.1.2.jar You can download it from here and add it to the class path If you are using the gradle then add the following dependency.

compile 'com.fasterxml.jackson.jaxrs:jackson-jaxrs-json-provider:2.5.2'

Examples related to java

Under what circumstances can I call findViewById with an Options Menu / Action Bar item? How much should a function trust another function How to implement a simple scenario the OO way Two constructors How do I get some variable from another class in Java? this in equals method How to split a string in two and store it in a field How to do perspective fixing? String index out of range: 4 My eclipse won't open, i download the bundle pack it keeps saying error log

Examples related to jar

Running JAR file on Windows 10 Add jars to a Spark Job - spark-submit Deploying Maven project throws java.util.zip.ZipException: invalid LOC header (bad signature) java.lang.NoClassDefFoundError: com/fasterxml/jackson/core/JsonFactory Maven Error: Could not find or load main class Where can I download mysql jdbc jar from? Access restriction: The type 'Application' is not API (restriction on required library rt.jar) Create aar file in Android Studio Checking Maven Version Creating runnable JAR with Gradle

Examples related to noclassdeffounderror

java.lang.NoClassDefFoundError: com/fasterxml/jackson/core/JsonFactory How to solve java.lang.NoClassDefFoundError? setting JAVA_HOME & CLASSPATH in CentOS 6 java.lang.NoClassDefFoundError: org/hamcrest/SelfDescribing Unable instantiate android.gms.maps.MapFragment Android java.lang.NoClassDefFoundError NoClassDefFoundError for code in an Java library on Android java.lang.NoClassDefFoundError: Could not initialize class XXX exception in thread 'main' java.lang.NoClassDefFoundError: java.lang.NoClassDefFoundError in junit

Examples related to live-streaming

How to embed new Youtube's live video permanent URL? java.lang.NoClassDefFoundError: com/fasterxml/jackson/core/JsonFactory EC2 instance types's exact network performance? Live-stream video from one android phone to another over WiFi What is the difference between RTP or RTSP in a streaming server?

Examples related to youtube-data-api

How can I get the actual video URL of a YouTube live stream? java.lang.NoClassDefFoundError: com/fasterxml/jackson/core/JsonFactory Google OAUTH: The redirect URI in the request did not match a registered redirect URI How do I get video durations with YouTube API version 3? How do I get a YouTube video thumbnail from the YouTube API?