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?
The String URL must be specified with a Core . as below
String urlString = "http://localhost:8983/solr/Core_name";
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.