Resolution nested exception is Java.lang.IllegalArgumentException:No converter found for return value of Type:class JAVA.UTIL.ARR Aylist problems

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.