Solr常见异常

1、RemoteSolrException: Expected mime type application/octet-stream but got text/html

现象:

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. <html><head><title>Apache Tomcat/7.0.54 - Error report</title><style><!--H1 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:22px;}
H2 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:16px;} H3 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:14px;} BODY {font-family:Tahoma,Arial,sans-serif;color:black;background-color:white;}
B {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;} P {font-family:Tahoma,Arial,sans-serif;background:white;color:black;font-size:12px;}A {color : black;}A.name {color : black;}HR {color : #525D76;}--></style> </head><body><h1>HTTP
Status 405 - HTTP method POST is not supported by this URL</h1><HR size="1" noshade="noshade"><p><b>type</b> Status report</p><p><b>message</b> <u>HTTP method POST is not supported by this URL</u></p><p><b>description</b> <u>The specified HTTP method is not
allowed for the requested resource.</u></p><HR size="1" noshade="noshade"><h3>Apache Tomcat/7.0.54</h3></body></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)

分析:

由于各种错误导致了solr返回一个错误页面,而不是index成功的结果,因此出现以上异常。

其中上述html代码格式化后呈现:

HTTP Status 405 - HTTP method POST is not supported by this URL



type Status report

message HTTP method POST is not supported by this URL

description The specified HTTP method is not allowed for the requested resource.


Apache Tomcat/7.0.54

解决方法:

在使用Tomcat部署Solr后,Collection1的地址为:http://182.92.160.44:8080/solr/#/collection1,但使用SolrJ进行索引的时候,应该使用http://182.92.160.44:8080/solr/collection1,即无中间的#号。

即正确代码为:

String serverUrl = (args != null && args.length > 0) ? args[0]
				: "http://182.92.160.44:8080/solr/collection1";

错误代码为:

String serverUrl = (args != null && args.length > 0) ? args[0]
				: "http://182.92.160.44:8080/solr/#/collection1";

错误代码将导致上述错误。

Solr常见异常

时间: 2024-08-28 23:14:28

Solr常见异常的相关文章

【solr专题之三】Solr常见异常

1.RemoteSolrException: Expected mime type application/octet-stream but got text/html 现象: SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder". SLF4J: Defaulting to no-operation (NOP) logger implementation SLF4J: See http://www.slf4j.o

2015-09-16 mysql 主从原理、 同步常见异常及恢复方法

1.原理 MySQL复制技术有以下一些特点:            (1)    数据分布 (Data distribution ) (2)    负载平衡(load balancing)             (3)    备份(Backups)           (4)    高可用性和容错行 High availability and failover 整体上来说,复制有3个步骤: (1)    master将改变记录到二进制日志(binary log)中(这些记录叫做二进制日志事件,

Hadoop常见异常及其解决方案

1.Shell$ExitCodeException 现象:运行hadoop job时出现如下异常: 14/07/09 14:42:50 INFO mapreduce.Job: Task Id : attempt_1404886826875_0007_m_000000_1, Status : FAILED Exception from container-launch: org.apache.hadoop.util.Shell$ExitCodeException: org.apache.hadoo

开通博客第一天 (先发一些android(java)常见异常信息

常见异常: java.lang.AbstractMethodError抽象方法错误.当应用试图调用抽象方法时抛出. java.lang.AssertionError断言错.用来指示一个断言失败的情况. java.lang.ClassCircularityError类循环依赖错误.在初始化一个类时,若检测到类之间循环依赖则抛出该异常. java.lang.ClassFormatError类格式错误.当Java虚拟机试图从一个文件中读取Java类,而检测到该文件的内容不符合类的有效格式时抛出. ja

Spring学习总结(14)——Spring10种常见异常解决方法

在程序员生涯当中,提到最多的应该就是SSH三大框架了.作为第一大框架的Spring框架,我们经常使用. 然而在使用过程中,遇到过很多的常见异常,我在这里总结一下,大家共勉. 一.找不到配置文件的异常 [plain] view plaincopy org.springframework.beans.factory.BeanDefinitionStoreException: IOException parsing XML document from class path resource [com/

开发常见异常

常见异常总结: 问题:IllegalAgumentExecption 问题:内存溢出异常 这个一般报[http-8080-3]之类的 1.在eclipse安装目录中将eclipse的启动参数调大一些: -startup plugins/org.eclipse.equinox.launcher_1.3.100.v20150511-1540.jar --launcher.library plugins/org.eclipse.equinox.launcher.win32.win32.x86_64_1

python常见异常分类与处理方法

Python常见异常类型大概分为以下类: 1.AssertionError:当assert断言条件为假的时候抛出的异常 2.AttributeError:当访问的对象属性不存在的时候抛出的异常 3.IndexError:超出对象索引的范围时抛出的异常 4.KeyError:在字典中查找一个不存在的key抛出的异常 5.NameError:访问一个不存在的变量时抛出的异常 6.OSError:操作系统产生的异常 7.SyntaxError:语法错误时会抛出此异常 8.TypeError:类型错误,

java中10大常见异常

NO.1 java.lang.NullPointerException 这个异常大家肯定都经常遇到,异常的解释是 "程序遇上了空指针 ",简单地说就是调用了未经初始化的对象或者是不存在的对象,这个错误经常出现在创建图片,调用数组这些操作中,比如图片未经初始化,或者图片创建时的路径错误等等.对数组操作中出现空指针,很多情况下是一些刚开始学习编程的朋友常犯的错误,即把数组的初始化和数组元素的初始化混淆起来了.数组的初始化是对数组分配需要的空间,而初始化后的数组,其中的元素并没有实例化,依然

Spring10种常见异常解决方法

在程序员生涯当中,提到最多的应该就是SSH三大框架了.作为第一大框架的Spring框架,我们经常使用. 然而在使用过程中,遇到过很多的常见异常,我在这里总结一下,大家共勉. 一.找不到配置文件的异常 [plain] view plaincopy org.springframework.beans.factory.BeanDefinitionStoreException: IOException parsing XML document from class path resource [com/