Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Exception : java.lang.ClassNotFoundException:com.fasterxml.jackson.core.exc.InputCoercionException

I am working on Java Springboot project which is deployed on Weblogic (12C) I am getting below error: Message icon - Error java.lang.ClassNotFoundException:com.fasterxml.jackson.core.exc.InputCoercionException

I have following dependency in POM.xml:

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

like image 915
Manjunath Kb Avatar asked Jan 17 '20 04:01

Manjunath Kb


People also ask

Why do I get “classnotfoundexception” in Java?

Even in Notepad, people have done java coding and by using the “ javac” command to compile the java files, and they will create a ‘.class’ file. Sometimes accidentally the generated class files might be lost or set in different locations and hence there are a lot of chances of “ClassNotFoundException” occurs.

What is the difference between Jackson core and Jackson-databind?

I had the same issue, i had updated the jackson-databind jar to 2.11.0, whereas jackson-core was using 2.6.6. Jackson-core is the base on which Jackson data-binding package builds on.

What is the latest version of Jackson dependencies?

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.


3 Answers

Add the following dependency to your pom.xml

<dependency>
    <groupId>com.fasterxml.jackson.core</groupId>
    <artifactId>jackson-core</artifactId>
    <version>2.10.1</version>
</dependency>
like image 162
Nick Avatar answered Sep 28 '22 00:09

Nick


I had the same issue, i had updated the jackson-databind jar to 2.11.0, whereas jackson-core was using 2.6.6. Jackson-core is the base on which Jackson data-binding package builds on.

If you're using maven for your dependency management, just include jackson-databind jar dependency and it should inject jackson-core dependency in your classpath as it has transitive dependency on this

Identify the jackson-core and jackson-databind version, by running this command in commandprompt of your project folder. For maven : mvn dependency:tree

E.g of my dependencies

com.fasterxml.jackson.core:jackson-databind:jar:2.11.0:compile com.fasterxml.jackson.core:jackson-core:jar:2.6.6:test

I am using 2.6.6 for running my test cases, so the scope is test.

So Solution, upgraded the jackson-core to 2.11.0 and build it. It will pass.

like image 32
the_code Avatar answered Sep 27 '22 22:09

the_code


I had this same issue, using the dataformat and databind libraries. It seems that in the new update you have to add the core library in order for the others to work:

compile group: 'com.fasterxml.jackson.core', name: 'jackson-core', version: '2.10.1'
like image 21
EBAq Avatar answered Sep 28 '22 00:09

EBAq