{"id":5450,"date":"2017-10-01T13:04:56","date_gmt":"2017-10-01T13:04:56","guid":{"rendered":"http:\/\/www.garysieling.com\/blog\/?p=5450"},"modified":"2017-10-01T13:04:56","modified_gmt":"2017-10-01T13:04:56","slug":"fixing-solrj-error-expected-mime-type-applicationoctet-stream-got-texthtml","status":"publish","type":"post","link":"https:\/\/www.garysieling.com\/blog\/fixing-solrj-error-expected-mime-type-applicationoctet-stream-got-texthtml\/","title":{"rendered":"Fixing Solrj error: &#8221; Expected mime type application\/octet-stream but got text\/html. &#8220;"},"content":{"rendered":"<p>If you try to do &#8220;getById&#8221; in SolrJ, you may get an error that the \/get endpoint for your core does not exist.<\/p>\n<pre>\nsolr.getById(collection, id)\n<\/pre>\n<p>This is what the error will look like:<\/p>\n<pre>\nError from server at http:\/\/localhost:8983\/solr\/articles: Expected mime type application\/octet-stream but got text\/html. <html>\n&lt;head>\n&lt;meta http-equiv=\"Content-Type\" content=\"text\/html;charset=utf-8\"\/>\n&lt;title>Error 404 Not Found<\/title>\n&lt;\/head>\n&lt;body>&lt;h2>HTTP ERROR 404&lt;\/h2>\n&lt;p>Problem accessing \/solr\/articles\/articles\/get. Reason:\n&lt;pre>    Not Found<&lt;pre>&lt;\/p>\n&lt;\/body>\n&lt;\/html>\n<\/pre>\n<p>The solution is to add the realtime-get request handler to your solrconfig.xml. You may also need to add a <a href=\"https:\/\/wiki.apache.org\/solr\/RealTimeGet\">setting to the update handler<\/a>.<\/p>\n<pre>\n&lt;requestHandler name=\"\/get\" class=\"solr.RealTimeGetHandler\">\n  &lt;lst name=\"defaults\">\n    &lt;str name=\"omitHeader\">true&lt\/;str>\n  &lt;\/lst>\n&lt;\/requestHandler>\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Fixing an error in getById in Solrj<\/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":[300,517,518],"aioseo_notices":[],"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/www.garysieling.com\/blog\/wp-json\/wp\/v2\/posts\/5450"}],"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=5450"}],"version-history":[{"count":0,"href":"https:\/\/www.garysieling.com\/blog\/wp-json\/wp\/v2\/posts\/5450\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.garysieling.com\/blog\/wp-json\/wp\/v2\/media?parent=5450"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.garysieling.com\/blog\/wp-json\/wp\/v2\/categories?post=5450"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.garysieling.com\/blog\/wp-json\/wp\/v2\/tags?post=5450"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}