1. remotesolrexception:expected MIME type application/octet-stream but got text/html
Phenomenon:
slf4j:failed to load Class "Org.slf4j.impl.StaticLoggerBinder".
Slf4j:defaulting to No-operation (NOP) Logger implementation
Slf4j:see Http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
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 Org.apache.solr.client.solrj.request.AbstractUpdateRequest.process (abstractupdaterequest.java:124)
At Org.apache.solr.client.solrj.SolrServer.add (solrserver.java:116)
At Org.apache.solr.client.solrj.SolrServer.add (solrserver.java:102)
At Org.ljh.test.solr.BasicSolrJIndexDemo.main (basicsolrjindexdemo.java:23)
Analysis:
The above exception occurs because the various errors caused SOLR to return an error page instead of the result of index success.
Where the above HTML code is formatted after rendering:
HTTP Status 405-http method POST is not supported by this URL
Type Status Report
Message HTTP method POST is not a supported by this URL
Description The specified HTTP method is not a allowed for the requested resource. Apache tomcat/7.0.54 Workaround:
After using Tomcat to deploy SOLR, the address of the Collection1 is: Http://ip:8080/solr/#/collection1, but when you use SOLRJ for indexing, you should use http://ip:8080/solr/ Collection1, that is, there is no middle # number.
That is, the correct code is:
String ServerURL = (args! = null && args.length > 0)? Args[0]
: "Http://ip:8080/solr/collection1";
The error code is:
String ServerURL = (args! = null && args.length > 0)? Args[0]
: "Http://ip:8080/solr/#/collection1";
The error code will cause the above error.