0

I am using spring framework. From a jsp page I am doing an ajax call which gives call to a controller written using spring framework. From this ajax call a json is passed as controller parameters.

I guess that if the json is small then everything is working fine but if the json length increases then I am getting following exception in the tomcat -

org.springframework.http.converter.HttpMessageNotReadableException: Could not read JSON: Unexpected end-of-input in VALUE_STRING at [Source: org.apache.catalina.connector.CoyoteInputStream@147fb5c4; line: 1, column: 6454794]; nested exception is org.codehaus.jackson.JsonParseException: Unexpected end-of-input in VALUE_STRING at [Source: org.apache.catalina.connector.CoyoteInputStream@147fb5c4; line: 1, column: 6454794]

Above exception is not coming every time for a big json. In the brower console & also in the network tab I am not getting anything(so not able to capture the json).

can some one please help me out in understanding what may be the cause for this issue & how to resolve this. Its really difficult to debug this scenario as its not always getting reproduced.

azhar_salati
  • 1,554
  • 5
  • 28
  • 54
  • Ok, color me intrigued. What do you need a 6.5M character JSON response for? Is it returning the text of an entire book to be shown in a single page? – t0mppa Jan 27 '14 at 16:58
  • Are you sending the request to the controller via "GET" (which will have length limits)? Have you tried "POST" (which should not have limits)? – David Fleeman Jan 27 '14 at 18:30
  • @t0mppa yeah i am unable to figure out why this big json is going as response. I am unable capture the json when this exception is occuring can u please tell me a way so that i can capture that json. As its not happening all the time its getting difficult to figure out why this big json is going as response – azhar_salati Jan 28 '14 at 05:12
  • Please read this post: http://stackoverflow.com/questions/266322/is-there-a-limit-to-the-length-of-a-get-request -- whatever browser you are using, I wonder if you are hitting the GET limit for some of your requests. – David Fleeman Jan 28 '14 at 05:20
  • @DavidFleeman oh sorry in the previous comment i used not... :) i am using POST to send the request to the controller...i have deleted my previous comment. – azhar_salati Jan 28 '14 at 05:34
  • Even if this big(6.5M) json is there in response, is there a way to process this kind of json. I mean to say this should not throw the exception as I am using post request and there is no limit set for the POST inside the tomcat server – azhar_salati Jan 28 '14 at 06:06
  • If it's way too big, then how about debugging the creation of said JSON? What kind of code is causing it to bloat so much? – t0mppa Jan 28 '14 at 19:40
  • @t0mppa yeah at the first place json should not be so big...i will find out the reason which part of code is causing the json to bloat so much.. – azhar_salati Jan 30 '14 at 06:08

0 Answers0