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.的更多相关文章

  1. 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 ...

  2. solrj 7.x Expected mime type application/octet-stream but got text/html.

    出现这种情况是因为baseurl填写错误,最开始的时候我写的是用tomcat启动后浏览器中访问solr的地址 结果就出现了如题的异常,当然提示的是404,还有可能提示405,Method not al ...

  3. Resource interpreted as Document but transferred with MIME type application/json laravel异常请求返回警告

    一般情况下,laravel在方法里可以向前端返回数组格式 return [], 框架可以自动将数组转成JSON字符串返回,但浏览器会报MIME类型警告, 如是做APP接口可以忽视该警告: 但在前端aj ...

  4. 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 ...

  5. Django 导入css文件,样式不起作用。Resource interpreted as Stylesheet but transferred with MIME type application/x-css

    笔者今天在模板中加载css文件时,发现 css样式能够下载再来却无法起作用,而且,图片.js都能够正常使用. 并且 浏览器提示: Resource interpreted as Stylesheet ...

  6. 解决IE浏览器中出现“Resource interpreted as Document but transferred with MIME type application/json”问题

    在上传图片时,使用ajax提交,返回的数据格式为json.在测试时发现IE浏览器中,上传图片后,没有显示图片,而是弹出一个提示:是否保存UploadImg.json文件:而在其他浏览器中正常. 在Ch ...

  7. 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 ...

  8. Resource interpreted as Document but transferred with MIME type application/json

    转自:https://blog.csdn.net/just_lover/article/details/81207472 我在修改并保存后,界面返回提示“undifine”,实际我是看到有返回提示的. ...

  9. IE8 MIME type application/json not found

    如果: public ContentResult GetPaper(string testId) {     return ControllProctector.Do1(() =>        ...

随机推荐

  1. datatables定义列宽自适应方法

    不同的分辨率以及浏览器自适应,列表不出现滚动条,表格内容自动换行. 方法:通过定义表格列属性,结合<table>CSS样式和定义的列单元格样式 'td_huanhang'/'td_unhu ...

  2. Python实战:美女图片下载器,海量图片任你下载

    Python应用现在如火如荼,应用范围很广.因其效率高开发迅速的优势,快速进入编程语言排行榜前几名.本系列文章致力于可以全面系统的介绍Python语言开发知识和相关知识总结.希望大家能够快速入门并学习 ...

  3. 關於Validform 控件 值得注意的地方

    Validform控件其實用起來挺方便的,直接百度就能找到官網,有直接的demo做參考.這些我就不提了,我所要說的是關於Validform控件的ajax的提交. Validform中有個參數ajaxP ...

  4. 高效删除 ListItem

    The most efficient way to a lot of transaction in SharePoint is using of SPWeb.ProcessBatchData meth ...

  5. Android开发手记(18) 数据存储三 SQLite存储数据

    Android为数据存储提供了五种方式: 1.SharedPreferences 2.文件存储 3.SQLite数据库 4.ContentProvider 5.网络存储 SQLite 是以嵌入式为目的 ...

  6. 微软未公开的 SP

    一些用在SQL 2000的企业管理GUI中,并且不打算用于其他的流程.微软已预计将其中的一些存储过程从未来的SQL Server版本中删除(或已经删除了).虽然这些存储过程可能很有用并为你节省了很多时 ...

  7. LINUX nohup命令输入输出深浅进出

    无论是否将 nohup命令的输出重定向到终端,输出都将附加到当前目录的 nohup.out 文件中.如果当前目录的 nohup.out 文件不可写,输出重定向到 $HOME/nohup.out 文件中 ...

  8. 分享red hat linux 6上安装oracle11g时遇到的gcc: error trying to exec 'cc1': execvp: No such file or directory的问题处理过程

    安装环境:Red Hat Linux 6.5_x64.oracle11g 64bit 报错详情: 安装到68%时弹窗报错: 调用makefile '/test/app/Administrators/p ...

  9. 解决WEB(apache)服务器time_wait过高的性能优化过程

    目录 1.网站的硬件环境 2.修改Httpd.conf 3.修改sysctl.conf文件 一.网站环境LAMP硬件环境 [root@www conf]# dmidecode -s processor ...

  10. Apache server-status

    1.找到apache配置文件:httpd.conf   2.打开模块: LoadModule status_module modules/mod_status.so   3.在文件末尾处加上以下代码: ...