Fixing Solrj error: ” Expected mime type application/octet-stream but got text/html. “

If you try to do “getById” in SolrJ, you may get an error that the /get endpoint for your core does not exist.

solr.getById(collection, id)

This is what the error will look like:

Error from server at http://localhost:8983/solr/articles: Expected mime type application/octet-stream but got text/html. 
<meta http-equiv="Content-Type" content="text/html;charset=utf-8"/>
<title>Error 404 Not Found
<body><h2>HTTP ERROR 404</h2>
<p>Problem accessing /solr/articles/articles/get. Reason:
<pre>    Not Found<<pre></p>

The solution is to add the realtime-get request handler to your solrconfig.xml. You may also need to add a setting to the update handler.

<requestHandler name="/get" class="solr.RealTimeGetHandler">
  <lst name="defaults">
    <str name="omitHeader">true</;str>

Interested in Solr? I send out weekly, personalized emails with articles and conference talks. Click here to see an example and subscribe.

0 replies

Leave a Reply

Want to join the discussion?
Feel free to contribute!

Leave a Reply

Your email address will not be published. Required fields are marked *