Java.Lang.Noclassdeffounderror: Com/Fasterxml/Jackson/Databind/Exc/Invaliddefinitionexception

Java.lang.NoClassDefFoundError: com/fasterxml/jackson/databind/exc/InvalidDefinitionException

Try to use the latest com.fasterxml.jackson.core/jackson-databind.
I upgraded it to 2.9.4 and it works now.

<!-- https://mvnrepository.com/artifact/com.fasterxml.jackson.core/jackson-databind -->
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>2.9.4</version>
</dependency>

java.lang.ClassNotFoundException: com.fasterxml.jackson.databind.exc.InvalidDefinitionException

Check which version of jackson-databind you are using.

According to that topic:

ClassNotFoundException: com.fasterxml.jackson.databind.exc.InvalidDefinitionException

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

Add the following dependency to your pom.xml

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

Exception in thread main java.lang.NoClassDefFoundError: com/fasterxml/jackson/databind/ObjectMapper on maven

You are using maven-jar-plugin to create a jar-with-dependencies.

I think you want to use maven-assembly-plugin instead.

In order to do this, change

<artifactId>maven-jar-plugin</artifactId>

to

<artifactId>maven-assembly-plugin</artifactId>

You may also need to add the execution to the plugin (as pointed out in the comments):

<executions>
<execution>
<id>make-assembly</id> <!-- this is used for inheritance merges -->
<phase>package</phase> <!-- bind to the packaging phase -->
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>

By the way, you may want to use use package instead of install.

Also execute the jar-with-dependencies and not the "normal" jar:

java -jar target/myApp-jar-with-dependencies.jar

java.lang.NoClassDefFoundError: com/fasterxml/jackson/databind/JsonMappingException



Related Topics



Leave a reply



Submit