I. BACKGROUND
Recently busy, want to build a set of SPRING+SPRINGMVC+MYBATIS+MYSQL environment (building steps will be given in the future blog), the results when running the program, the application of @responsebody annotations to return list< objects > JSON data appears: Nested exception is Java.lang.IllegalArgumentException:No converter found for return value of Type:class JAV A.util.arraylist error, the analysis of the next, and then solve the problem, first take to backup and share!
Second, the framework to build the environment
1.JDK 1.7
2.maven 3.3.9
3.spring 4.2.6.RELEASE
4.springmvc 4.2.6.RELEASE
5.mybatis 3.2.8
Third, the cause of the error and resolution steps
1. Reason: This is because SPRINGMVC default is that no object is converted to a JSON converter and needs to be manually added to the Jackson dependency.
2. Steps to resolve:
Manually add Jackson to the Pom.xml file
<Properties> <jackson.version>2.5.4</jackson.version> </Properties>
<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>
If it is still not resolved, follow these steps
In the SPRINGMVC configuration file, configure the following
<Mvc:annotation-driven> <mvc:message-converters> <Beanclass= "Org.springframework.http.converter.StringHttpMessageConverter"/> <Beanclass= "Org.springframework.http.converter.json.MappingJackson2HttpMessageConverter"/> </mvc:message-converters></Mvc:annotation-driven>
So that we can solve the problem perfectly.
Iv. Summary
We build the framework of the process, we must learn to think more about themselves, encounter problems to go over the source code, so that we solve the problem is very helpful.
Resolution nested exception is Java.lang.IllegalArgumentException:No converter found for return value of Type:class JAVA.UTIL.ARR Aylist problems