Gary Sieling

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. 
<head>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8"/>
<title>Error 404 Not Found
</head>
<body><h2>HTTP ERROR 404</h2>
<p>Problem accessing /solr/articles/articles/get. Reason:
<pre>    Not Found</p>
</body>
</html>

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&lt/;str>
  </lst>
</requestHandler>
Exit mobile version