• Register
0 votes
316 views

Problem :

I am very new to Spring Boot. I am learning to write code in Spring Boot. I have written my first Spring Boot code as below

@RequestMapping(value = "/bar/foo", method = RequestMethod.GET)
    public MyResponseEntity<foo> foo() {
Foo model;
        ...
        return MyResponseEntity.ok(model);
    }
}

But I am facing below exception

“Java.lang.IllegalArgumentException: No converter found for return value of type”

I am unable to understand the above exception.

I have also tried to add the Jackson to my pom.xml as shown below but still I am facing the above exception

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

How can I fix above Spring Boot exception?

8 4 2
2,300 points

1 Answer

0 votes

Solution :

I have understood your problem. If you are receiving the Converter error then a most possible cause is that a Jackson is unable to find the necessary getter methods. Please check your POJO getter methods very carefully. In my case my mistake was I had the lower-cased getter on one of the property instead of a expected camel case e.g  getmetaTag() instead of getMetaTag().

You can also try to add a below dependency to your pom.xml:

<dependency>

    <groupId>com.fasterxml.jackson.core</groupId>

    <artifactId>jackson-databind</artifactId>

    <version>2.10.0.pr3</version>

</dependency>

In some cases If you forgot to add the library jackson-core.jar along with jackson-annotations.jar and jackson-databind.jar. Then try adding these jars it will fix your issue.

5 2 1
4,980 points

Related questions

0 votes
1 answer 263 views
263 views
Problem : I want to POST the List of custom objects. My JSON in a request body is as below : {     "collection": [         {             "name": "Test ordert1",             "detail": "ahk ksa"         },         {             "name": "Test ... } But I am facing below error: &ldquo;Can not deserialize instance of java.util.arraylist out of start_object token&rdquo; How can I fix the above error?
asked Jan 21 jwilliam 3.9k points
0 votes
1 answer 4K views
4K views
Problem : I am trying to POST a List of custom objects but i am getting exception as below can not deserialize instance of java.util.arraylist out of start_object token
asked Oct 22, 2019 peterlaw 6.9k points
0 votes
2 answers 179 views
179 views
Problem : I have created entities, services and JUnit tests for services using Spring and Hibernate for my project. All of these are working. After that I added spring-mvc to it to make this web application but while trying to make ... follows ..Could not autowire field: public pl.com.radzikowski.webmail.service.IMailManager pl.com.radzikowski.webmail.controller.HomeController.mailManager...
asked Nov 20, 2019 peterlaw 6.9k points
0 votes
1 answer 4K views
4K views
Problem : After executing spring boot with h2 database and JPA i am facing below error org.hibernate.tool.schema.spi.commandacceptanceexception: error executing ddl via jdbc statement
asked Nov 12, 2019 peterlaw 6.9k points
0 votes
1 answer 265 views
265 views
Problem : Currently I am trying to display a JSON content using a API key. But I am unable to get a authentication. I am facing below error in my JsonObject: &ldquo;Org.json.JSONException: Value Authorization of type java.lang.String cannot be converted to JSONObject&rdquo; In my ... to pass a API key and URL id to get my JSON response in a URL. I display a JSON content using a JSON array.
asked Feb 2 jwilliam 3.9k points