Fixing Solr error org.noggit.JSONParser$ParseException: Expected quoted string: char=(EOF),...

Datetime:2016-08-23 02:00:54         Topic: Solr          Share        Original >>
Here to See The Original Article!!!

If you try to post data to Solr, you may see these errors:

badMessage: java.lang.IllegalStateException: 
too much data after closed for HttpChannelOverHttp@19febb04{r=1,​c=false,​a=IDLE,​uri=-}

Expected quoted string: char=(EOF),​position=15 BEFORE=''

This isn’t actually a JSON parsing error – it indicates that the Jetty server cut off the request, which led to failure to parse JSON.

The cause of this is that you need to use chunked encoding in the request payload. If you’re using Node, a lot of examples have you set Content-Length in the post, which implicitly disables chunked encoding:

const postOptions = {
    host: 'localhost',
    port: 8983,
    path: '/solr/talks/update?wt=json', 
    method: 'POST',
    headers: {
      'Content-Type': 'text/json',
      'Content-Length': Buffer.byteLength(data)

The fix then, is to simply remove “Content-Length.”

Looking for a new book to read? My younger sister is writing an imaginative series of sci-fi novels , set in a futuristic world with a novel form of space travel.


Put your ads here, just $200 per month.