{"id":4911,"date":"2016-08-12T12:38:00","date_gmt":"2016-08-12T12:38:00","guid":{"rendered":"http:\/\/www.garysieling.com\/blog\/?p=4911"},"modified":"2016-08-12T12:38:00","modified_gmt":"2016-08-12T12:38:00","slug":"fixing-solr-error-org-noggit-jsonparserparseexception-expected-quoted-string-chareof%e2%80%8bposition15","status":"publish","type":"post","link":"https:\/\/www.garysieling.com\/blog\/fixing-solr-error-org-noggit-jsonparserparseexception-expected-quoted-string-chareof%e2%80%8bposition15\/","title":{"rendered":"Fixing Solr error org.noggit.JSONParser$ParseException:  Expected quoted string: char=(EOF),\u200bposition=15 BEFORE=&#8221;"},"content":{"rendered":"<p>If you try to post data to Solr, you may see these errors:<\/p>\n<pre>\nbadMessage: java.lang.IllegalStateException: \ntoo much data after closed for HttpChannelOverHttp@19febb04{r=1,\u200bc=false,\u200ba=IDLE,\u200buri=-}\n\norg.noggit.JSONParser$ParseException: \nExpected quoted string: char=(EOF),\u200bposition=15 BEFORE=''\n<\/pre>\n<p>This isn&#8217;t actually a JSON parsing error &#8211; it indicates that the Jetty server cut off the request, which led to failure to parse JSON.<\/p>\n<p>The cause of this is that you need to use chunked encoding in the request payload. If you&#8217;re using Node, a lot of examples have you set Content-Length in the post, which implicitly disables chunked encoding:<\/p>\n<pre lang=\"javascript\">\n const postOptions = {\n    host: 'localhost',\n    port: 8983,\n    path: '\/solr\/talks\/update?wt=json', \n    method: 'POST',\n    headers: {\n      'Content-Type': 'text\/json',\n      'Content-Length': Buffer.byteLength(data)\n    }\n  }\n<\/pre>\n<p>The fix then, is to simply remove &#8220;Content-Length.&#8221;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Fixing a JSON parsing error in Solr<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"om_disable_all_campaigns":false,"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"footnotes":""},"categories":[9],"tags":[517],"aioseo_notices":[],"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/www.garysieling.com\/blog\/wp-json\/wp\/v2\/posts\/4911"}],"collection":[{"href":"https:\/\/www.garysieling.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.garysieling.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.garysieling.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.garysieling.com\/blog\/wp-json\/wp\/v2\/comments?post=4911"}],"version-history":[{"count":0,"href":"https:\/\/www.garysieling.com\/blog\/wp-json\/wp\/v2\/posts\/4911\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.garysieling.com\/blog\/wp-json\/wp\/v2\/media?parent=4911"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.garysieling.com\/blog\/wp-json\/wp\/v2\/categories?post=4911"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.garysieling.com\/blog\/wp-json\/wp\/v2\/tags?post=4911"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}