java.lang.IllegalArgumentException: No converter found for return value of type

We Are Going To Discuss About java.lang.IllegalArgumentException: No converter found for return value of type. So lets Start this Java Article.

java.lang.IllegalArgumentException: No converter found for return value of type

  1. java.lang.IllegalArgumentException: No converter found for return value of type

    The problem was that one of the nested objects in Foo didn't have any getter/setter

  2. java.lang.IllegalArgumentException: No converter found for return value of type

    The problem was that one of the nested objects in Foo didn't have any getter/setter

Solution 1

The problem was that one of the nested objects in Foo didn’t have any getter/setter

Original Author Marc Of This Content

Solution 2

Add the below dependency to your pom.xml:

 <dependency>
    <groupId>com.fasterxml.jackson.core</groupId>
    <artifactId>jackson-databind</artifactId>
    <version>2.10.0.pr3</version>
</dependency>

Original Author PAA Of This Content

Solution 3

Add the getter/setter missing inside the bean mentioned in the error message.

Original Author Soumyajit Swain Of This Content

Solution 4

Use @ResponseBody and getter/setter. Hope it will solve your issue.

@RequestMapping(value = "/bar/foo", method = RequestMethod.GET)
@ResponseBody
public ResponseEntity<foo> foo() {

and update your mvc-dispatcher-servlet.xml:

<mvc:annotation-driven>
     <mvc:message-converters>
            <bean class="org.springframework.http.converter.StringHttpMessageConverter"/>
            <bean class="org.springframework.http.converter.json.MappingJackson2HttpMessageConverter"/>
   </mvc:message-converters>
</mvc:annotation-driven>

Original Author SkyWalker Of This Content

Conclusion

So This is all About This Tutorial. Hope This Tutorial Helped You. Thank You.

Also Read,

Siddharth

I am an Information Technology Engineer. I have Completed my MCA And I have 4 Year Plus Experience, I am a web developer with knowledge of multiple back-end platforms Like PHP, Node.js, Python and frontend JavaScript frameworks Like Angular, React, and Vue.

Leave a Comment