Unsupported ContentType: application/octet-stream in Apache Solr's admin tool

June 5, 2015

While testing a demo of Apache Solr’s abilities today, I ran into a problem with Solr’s Admin tool. I had prepared the demo on my Macbook a few days earlier and everything had worked but as soon as I tried to import the same JSON file via Documents / File Upload on a Windows or Ubuntu machine I got the following error:

Unsupported ContentType: application/octet-stream
Not in: [application/xml, text/csv, text/json, application/csv, application/javabin, text/xml, application/json]

So what happened? Windows and Ubuntu don’t seem to know the proper mime type for JSON files (which by the way is application/json).

Solution for Windows systems

Open regedit.exe and add the key-value pair

"Content Type": "application/json"

to

HKEY_LOCAL_MACHINE\SOFTWARE\Classes\.json

Solution for Linux systems

Add the line

application/json json

to

/etc/mime.types