Spring-Boot 2.1.2 and class com.fasterxml.jackson.annotation.JsonInclude

10,345

jackson-core,jackson-annotations and jackson-databind jars are automatically added by spring boot. so you don't need to add them explicitly unless you want to override the version of the jar that are provided by spring boot .

enter image description here

Share:
10,345

Related videos on Youtube

Helio Aymoto
Author by

Helio Aymoto

Updated on June 04, 2022

Comments

  • Helio Aymoto
    Helio Aymoto almost 2 years

    My Sprint boot application is not coming up because it's complaining about missing class com.fasterxml.jackson.annotation.JsonInclude$Value, but I have jackson library as dependency, so I think it might be possible some conflict.

    SPRING LOG:

     :: Spring Boot ::        (v2.1.2.RELEASE)
    
    00:22:54.084 [main      ] ERROR ngframework.boot.web.embedded.tomcat.TomcatStarter - Error starting Tomcat context. Exception: org.springframework.beans.factory.BeanCreationException. Message: Error creating bean with name 'formContentFilter' defined in class path resource [org/springframework/boot/autoconfigure/web/servlet/WebMvcAutoConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.boot.web.servlet.filter.OrderedFormContentFilter]: Factory method 'formContentFilter' threw exception; nested exception is java.lang.NoClassDefFoundError: Could not initialize class com.fasterxml.jackson.annotation.JsonInclude$Value
    00:22:55.063 [main      ] ERROR         org.springframework.boot.SpringApplication - Application run failed
    

    pom.xml (dependencies):

    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-web</artifactId>
        <version>2.1.2.RELEASE</version>
    </dependency>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-test</artifactId>
        <version>2.1.2.RELEASE</version>
        <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>io.springfox</groupId>
        <artifactId>springfox-swagger2</artifactId>
        <version>2.9.2</version>
    </dependency>
    <dependency>
        <groupId>com.fasterxml.jackson.core</groupId>
        <artifactId>jackson-databind</artifactId>
        <version>2.9.4</version>
    </dependency>
    <dependency>
        <groupId>com.fasterxml.jackson.core</groupId>
        <artifactId>jackson-core</artifactId>
        <version>2.9.4</version>
    </dependency>
    <dependency>
        <groupId>com.fasterxml.jackson.core</groupId>
        <artifactId>jackson-annotations</artifactId>
        <version>2.9.4</version>
    </dependency>
    

    Has anybody already faced similar issue? Thanks

    • Darren Forsythe
      Darren Forsythe about 5 years
      Please use either the Spring Boot parent POM or BOM. Spring boot is tested against specific versions of dependencies which the BOM or POM avoid.
  • Vüsal
    Vüsal about 5 years
    "unless you want to override the version of the jar that are provided by spring boot" -To override you have to first exclude existing ones from spring-boot dependency.
  • Darren Forsythe
    Darren Forsythe about 5 years
    @Vusal or you can set the jackson.version property if using Parent POM or place the jackson BOM before spring boots.
  • techasutos
    techasutos about 5 years
    you can just add or manage dependency from the spring tool suite dependency management tab. if you are mentioning version then it will automatically override the spring managed version