SOLR Exception--expected MIME type Application/octet-stream but got text/html.

Source: Internet
Author: User
Tags solr apache tomcat

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.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.