solr异常--Expected mime type application/octet-stream but got text/html.
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 404 - /solr/core0/update/extract</h1><HR size="1" noshade="noshade"><p><b>type</b> Status report</p><p><b>message</b> <u>/solr/core0/update/extract</u></p><p><b>description</b> <u>The requested resource is not available.</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 solrj.CreateIndexFromPDF.indexFilesSolrCell(CreateIndexFromPDF.java:54)
at solrj.CreateIndexFromPDF.main(CreateIndexFromPDF.java:21)
部分代码:
String urlString = "http://localhost:8080/solr/core0";
SolrServer solr = new HttpSolrServer(urlString);
ContentStreamUpdateRequest up = new ContentStreamUpdateRequest("/update/extract");
是因为我用的: core0 (这个在当前的solr目录下是不存在的),已经被删除了。改为存在collection1 就正常通过。
所以有这样的错误一般是配置错误,或者操作的core核心不存在,或者没有配置对应的handler。都是路径错误,或者用法上的错误。
---------------------------------------
public class CreateIndexFromPDF {
public static void main(String[] args)
{
String fileName = "E:/apache-solr-ref-guide-4.4.pdf";
String solrId = "solr用户指南中文版.pdf";
try
{
indexFilesSolrCell(fileName, solrId);
}
catch (IOException e)
{
e.printStackTrace();
}
catch (SolrServerException e)
{
e.printStackTrace();
}
}
/** 从文件创建索引
* <功能详细描述>
* @param fileName
* @param solrId
* @see [类、类#方法、类#成员]
*/
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(fileName), 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异常--Expected mime type application/octet-stream but got text/html.的更多相关文章
- solrj6.2异常--Expected mime type application/octet-stream but got text/html.
org.apache.solr.client.solrj.impl.HttpSolrClient$RemoteSolrException: Error from server at http://19 ...
- solrj 7.x Expected mime type application/octet-stream but got text/html.
出现这种情况是因为baseurl填写错误,最开始的时候我写的是用tomcat启动后浏览器中访问solr的地址 结果就出现了如题的异常,当然提示的是404,还有可能提示405,Method not al ...
- Resource interpreted as Document but transferred with MIME type application/json laravel异常请求返回警告
一般情况下,laravel在方法里可以向前端返回数组格式 return [], 框架可以自动将数组转成JSON字符串返回,但浏览器会报MIME类型警告, 如是做APP接口可以忽视该警告: 但在前端aj ...
- odoo 错误 Resource interpreted as Stylesheet but transferred with MIME type application/x-css:
odoo8 页面内容显示一半, web 控制台显示错误 Resource interpreted as Stylesheet but transferred with MIME type ap ...
- Django 导入css文件,样式不起作用。Resource interpreted as Stylesheet but transferred with MIME type application/x-css
笔者今天在模板中加载css文件时,发现 css样式能够下载再来却无法起作用,而且,图片.js都能够正常使用. 并且 浏览器提示: Resource interpreted as Stylesheet ...
- 解决IE浏览器中出现“Resource interpreted as Document but transferred with MIME type application/json”问题
在上传图片时,使用ajax提交,返回的数据格式为json.在测试时发现IE浏览器中,上传图片后,没有显示图片,而是弹出一个提示:是否保存UploadImg.json文件:而在其他浏览器中正常. 在Ch ...
- Invalid mime type "application nd.ms-excel; charset=utf-8;charset=utf-8": does not contain '/'
org.springframework.web.util.NestedServletException: Request processing failed; nested exception is ...
- Resource interpreted as Document but transferred with MIME type application/json
转自:https://blog.csdn.net/just_lover/article/details/81207472 我在修改并保存后,界面返回提示“undifine”,实际我是看到有返回提示的. ...
- IE8 MIME type application/json not found
如果: public ContentResult GetPaper(string testId) { return ControllProctector.Do1(() => ...
随机推荐
- Lucene技术杂谈
Lucene教程 1 lucene简介 1.1 什么是lucene Lucene是一个全文搜索框架,而不是应用产品.因此它并不像www.baidu.com 或者google Desktop那么 ...
- SHELL:Find Memory Usage In Linux (统计每个程序内存使用情况)
转载一个shell统计linux系统中每个程序的内存使用情况,因为内存结构非常复杂,不一定100%精确,此shell可以在Ghub上下载. [root@db231 ~]# ./memstat.sh P ...
- O-C相关-03:面向对象概念的具体介绍
1.面向对象的概念 面向对象(object-oriented ;简称: OO) 至今还没有统一的概念,我这里把它定义为:按人们认识客观世界的系统思维方式,采用基于对象(实体)的概念建立模型,模拟客观世 ...
- C与C++的区别
C++与C的区别 1. 动态分配内存 1)C语言 a. malloc函数:在内存的动态存储区中分配一个长度为size的连续空间: void *malloc(unsigned int siz ...
- zoj1276矩阵连乘dp
很经典的入门dp /*******************************************************************************/ /* OS : 3 ...
- 寒假ACM训练(二)
放了假的效率明显就低起来,最近也一直在学习Ubuntu,所以一直等到今天才写. 还是在用PC. 真的十分郁闷这个LC-Display,其实从思路上是有很多.不过我最后把他当成8字,分成了七笔. 一直W ...
- ACM YTU 十进制与八进制的转换 (栈和队列) STL栈调用
十进制与八进制的转换(栈和队列) Description 对于输入的任意一个非负十进制整数,利用栈打印输出与其等值的八进制数. Input 111 Output 157 Sample Input 14 ...
- PinchEvent QML Type
PinchEvent类型在QtQuick 1.1中被添加进来.center, startCenter, previousCenter属性保存了两个触摸点之间的中心位置.scale and previo ...
- virtalBox共享文件夹设置
sudo mount -t vboxsf gongxiang /mnt/shared/
- BASLER 镜头选型白皮书
本文翻译自Basler镜头选型白皮书 有许多方法来进行镜头选型.本文将会讨论其中的指导原则,以帮助你在项目中选择合适的镜头.我们将讨论许多镜头的基本概念,比如镜头接口.图像大小.放大率.焦距.F数和光 ...