Exception in thread "main" org.apache.solr.client.solrj.impl.httpsolrserver$remotesolrexception:
expected MIME type application/octet-stream but got text/html.
At Org.apache.solr.client.solrj.impl.HttpSolrServer.executeMethod (httpsolrserver.java:516)
At org.apache.solr.client.solrj.impl.HttpSolrServer.request (httpsolrserver.java:210)
At org.apache.solr.client.solrj.impl.HttpSolrServer.request (httpsolrserver.java:206)
At Solrj. Createindexfrompdf.indexfilessolrcell (createindexfrompdf.java:54)
At SOLRJ. Createindexfrompdf.main (createindexfrompdf.java:21)
Part of the code:
  String urlstring = "Http://localhost:8080/solr/core0";
solrserver solr = new Httpsolrserver (urlstring);
contentstreamupdaterequest up = new Contentstreamupdaterequest ("/update/extract");
Because I used: core0 (which does not exist in the current SOLR directory), has been deleted. Instead of being collection1, it passed normally.
So there are errors that are usually misconfigured, or the core core of the operation does not exist, or the corresponding handler is not configured. is either a path error, or a usage error.
---------------------------------------
public class Createindexfrompdf {
public static void Main (string[] args)
{
String fileName = "E:/apache-solr-ref-guide-4.4.pdf";
String Solrid = "SOLR User Guide Chinese version. pdf";
Try
{
Indexfilessolrcell (FileName, Solrid);
}
catch (IOException E)
{
E.printstacktrace ();
}
catch (Solrserverexception e)
{
E.printstacktrace ();
}
}
/** creating an index from a file
* < function Detail Description >
* @param fileName
* @param Solrid
* @see [Class, Class # method, Class # member]
*/
public static void Indexfilessolrcell (String fileName, String solrid)
Throws IOException, Solrserverexception
{
String urlstring = "HTTP://LOCALHOST:8080/SOLR/CORE0";
Solrserver SOLR = new Httpsolrserver (urlstring);
Contentstreamupdaterequest up = new Contentstreamupdaterequest ("/update/extract");
String contenttype= "Application/pdf";
Up.addfile (new File, ContentType);
Up.setparam ("Literal.id", Solrid);
Up.setparam ("Uprefix", "attr_");
Up.setparam ("Fmap.content", "attr_content");
Up.setaction (AbstractUpdateRequest.ACTION.COMMIT, True, true);
Solr.request (UP);
Queryresponse RSP = solr.query (New Solrquery ("*:*"));
SYSTEM.OUT.PRINTLN (RSP);
}
}
SOLR Exception--expected MIME type Application/octet-stream but got text/html.