• Register
0 votes
546 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

Please log in or register to answer this question.

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 7 views
7 views
Problem: org.apache.catalina.lifecycleexception: failed to start component [connector[http/1.1-8080]]
asked 6 days ago Lucky Guy 1.4k points
0 votes
1 answer 317 views
317 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, 2020 jwilliam 3.9k points
0 votes
1 answer 5.2K views
5.2K 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
1 answer 4.6K views
4.6K 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
2 answers 242 views
242 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 898 views
898 views
Problem : Currently I am trying to develop the REST API using the Spring Framework I am unable to run my application because of below error. Description: The Tomcat connector configured to listen on port 8080 failed to start. The port may already be in use or the connector may ... this application to listen on another port. My 8080 port on my PC is seems to be busy. How can I fix this issue?
asked Feb 28, 2020 mphil 2.3k points
0 votes
2 answers 66 views
66 views
Problem : Facing bellow Spring boot error unable to start embeddedwebapplicationcontext due to missing embeddedservletcontainerfactory bean.
asked Nov 8, 2019 peterlaw 6.9k points
0 votes
1 answer 5 views
5 views
Problem: org.json.jsonexception: value <br of type java.lang.string cannot be converted to jsonobject
asked 6 days ago Lucky Guy 1.4k points
0 votes
1 answer 444 views
444 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, 2020 jwilliam 3.9k points
0 votes
1 answer 2.4K views
2.4K views
Problem : I am trying to use the curl command as follows: curl -u 591bf65f50057469f10b5fd9:0cf17f9b03d056ds0e11e48497e506a2 https://backend.tdk.com/api/devicetypes/59147fd79e93s12e61499ffe/messages But I am getting a JSON response as follows: {"data":[{"device":"18SE62"," ... T>, Object...) in the type RestTemplate is not applicable for the arguments (String, HttpEntity<String>,Class<MessageList>)
asked Dec 10, 2019 alecxe 7.5k points