Reputation: 819
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?
Upvotes: 2
Views: 7047
Reputation: 11
The String URL must be specified with a Core. as below
String urlString = "http://localhost:8983/solr/Core_name";
Upvotes: 1
Reputation: 435
i think your urlString is not correct , it need apped your core name , such as:
Upvotes: 3