2

I am trying to start a Solr server programmatically in Java and I am using the resources from the official tutorial. My code is:

String urlString = "http://localhost:8983/solr";
SolrClient solr = new HttpSolrClient(urlString);

SolrInputDocument document = new SolrInputDocument();
document.addField("id", "552199");
document.addField("name", "Gouda cheese wheel");
document.addField("price", "49.99");
UpdateResponse response = solr.add(document);


solr.commit();

The problem is that I can neither launch the server programmaticaly (I do it via the Command Prompt) and I get this error:

 Exception in thread "main" org.apache.solr.client.solrj.impl.HttpSolrClient$RemoteSolrException: Error from server at http://localhost:8983/solr: Expected mime type application/octet-stream but got text/html. <html>

Any idea what is going on and how I can fix that?

deadpixels
  • 769
  • 1
  • 12
  • 21
  • check with http://stackoverflow.com/questions/29277972/indexing-documents-using-solr-results-in-expected-mime-type-application-octet-st – Abhijit Bashetti Aug 24 '15 at 06:16

2 Answers2

2

i think your urlString is not correct , it need apped your core name , such as:

enter image description here

Qin Dong Liang
  • 415
  • 3
  • 12
1

The String URL must be specified with a Core. as below

String urlString = "http://localhost:8983/solr/Core_name";
Ashok kumar Ganesan
  • 1,098
  • 5
  • 20
  • 48