ObjectMapper throw java.io.EOFException: No content to map to

标签:
jsonjacksoneofexceptionendinput |
分类: 框架 |
I have a response from a REST web service that looks like this:-
and I am attempting to use the method outlined here in the full data binding example http://wiki.fasterxml.com/JacksonInFiveMinutes#Full_Data_Binding_.28POJO.29_Example I have created a class which looks like this:-
My code to parse this response looks like this:-
But it throws the following error:-
Can anyone help me by explaining why this is happening? I thought perhaps it was because the messages are empty, but I tried putting dummy data in there and it still failed. I've looked for the ObjectMapper code and it seems to think it can't find the first token (am i correct?) but I can't see why it won't be able to find it? any help would be appreciated!
|
|||||||||||||
|
Even I faced same issue in my Spring MVC project for REST call.The mistake in my code was I used @RequestBody in controller method for a GET call. I mapped the method for POST request and the issue is resolved.
|
|||
I ran into this issue as well. In a Spring MVC
Unfortunately, by using
|
|||
I just ran into the same issue. I had an inordinately long stream from the response. Converting it to a String helped get past the initial exception. That didn't solve everything, though, so I ended up adding 0-arg constructors to all of the pojos involved in the mapping. The mapper worked perfectly after that.
|
|||||
|
I also faced the issue but the reason is just an In case of we provide a empty string we get :
To resolve this please validate json data before processing.
|
|||
I just got same error. After tracing, my issue was caused by the wrong parameter passed in javascript functions which caused undefined data was send to REST service. logs as below, the line "Content-Length: 0" hint the root cause.
|
|||
I ran into the the issue, but I used curl to send to request. The original command for data section is -d "{'ID':123, 'Name':'ABC'}" After I changed to -d '{"ID":123, "Name":"ABC"}' Then the problem was solved.
|
|||
I got the same issue because some of my JSON attributes had the value null. Removing the null values from the JSON completely got rid of the error.
|
|||
I have acounter this issue when I send the request as the HTTP GET Method, after change the HTTP GET to HTTP POST Method, This problem is solved. You can try as I say, hope this will help you....
|
|||