Spring Toolbox - NoClassDefFoundError MappingJackson2XmlHttpMessageConverter
I am new to Spring and I am starting to learn from my site. Understanding Java is not difficult for me, but I have problems with the environment. I followed this tutorial for using Spring Boot to create a new project and everything went great https://spring.io/guides/gs/spring-boot/
Now, I would like to run this project from the Spring Tool Suite, but I get this error when I try to run the same code on a Pivotal or Tomcat server.
Failed to instantiate [org.springframework.boot.autoconfigure.web.HttpMessageConverters]:> Factory method 'messageConverters' threw an exception; nested exception - java.lang.NoClassDefFoundError: org / springframework / http / converter / xml / MappingJackson2XmlHttpMessageConverter
Any help from Spring developers to fix my workflow?
When you try to run a project through a server, first build it with maven to download all dependencies. It also helps load the MappingJackson2XmlHttpMessageConverter. After creating it, deploy the war you create on the server.
This class was added in spring from 4.1 . You must add
compile('org.springframework:spring-web:4.1.4.RELEASE')
for gradle, or
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
<version>4.1.4.RELEASE</version>
</dependency>
for maven.