【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.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://ip:8080/solr/#/collection1,但使用SolrJ进行索引的时候,应该使用http://ip:8080/solr/collection1。即无中间的#号。

即正确代码为:

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

错误代码为:

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

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

时间: 2024-08-30 05:56:19

【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

Solr学习总结 Solr的安装与配置

接着前一篇,这里总结下Solr的安装与配置 1.准备 1.安装Java8 和 Tomcat9 ,java和tomcat 的安装这里不再重复.需要注意的是这两个的版本兼容问题.貌似java8 不支持,tomcat7 以下版本. 2.下载 solr安装包,目前的最新版本是  5.3.1 下载地址:http://www.apache.org/dyn/closer.lua/lucene/solr/5.3.1 2.安装 1.  将 solr 压缩包解压,并将solr-5.3.1\server\solr-w

图像处理之三种常见双立方插值算法

http://blog.csdn.net/jia20003/article/details/40020775 图像处理之三种常见双立方插值算法 双立方插值计算涉及到16个像素点,其中(i', j')表示待计算像素点在源图像中的包含 小数部分的像素坐标,dx表示X方向的小数坐标,dy表示Y方向的小数坐标.具体 可以看下图: 根据上述图示与双立方插值的数学表达式可以看出,双立方插值本质上图像16个像素点 权重卷积之和作为新的像素值. 其中R(x)表示插值表达式,可以根据需要选择的表达式不同.常见有基

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/

从老solr导入新solr

#!/usr/bin/python import solr import re import urllib import pycurl import cStringIO import collections import operator import string import json import pysolr def solr_update(value): pass def function(value): value_1={} keys=value.keys() t1=value[ke

开发常见异常

常见异常总结: 问题: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