Solr:服务器位于http:// localhost:8080 // solr返回非正常状态:500,消息:内部服务器错误

时间:2013-06-28 05:04:28

标签: solr solrj

当我尝试使用solrj api索引solr服务器上的文本文件时,我不断得到此error "Server at solr 8080 returned non ok status:500, message:Internal Server Error"

我的代码如下:

public void IndexData(String filePath,String solrId)
{
        try {

            String urlString = "http://localhost:8080//solr";
            HttpSolrServer  server  = new HttpSolrServer(urlString);


            ContentStreamUpdateRequest up 
              = new ContentStreamUpdateRequest("/update/extract");

            up.addFile(new File(filePath),"");

            up.setParam("literal.id", solrId);
            up.setParam("uprefix", "attr_");
            up.setParam("fmap.content", "attr_content");

            up.setAction(AbstractUpdateRequest.ACTION.COMMIT,                     true,true);

            server.request(up);
        } catch (IOException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        } catch (SolrServerException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        } catch (Exception e) {
            // TODO: handle exception
            e.printStackTrace();
        }

}

我能够使用相同的服务器查询solr服务器,但在索引数据时,为什么我收到此错误?

log4j:WARN No appenders could be found for logger (org.apache.solr.client.solrj.impl.HttpClientUtil).
log4j:WARN Please initialize the log4j system properly.
org.apache.solr.client.solrj.impl.HttpSolrServer$RemoteSolrException: Server at `http://localhost:8080//solr` returned non ok status:500, message:Internal Server Error
    at org.apache.solr.client.solrj.impl.HttpSolrServer.request(HttpSolrServer.java:372)
    at org.apache.solr.client.solrj.impl.HttpSolrServer.request(HttpSolrServer.java:180)
    at dataAnalysis.dataIndexer.DataIndexer.IndexData(DataIndexer.java:41)
    at dataAnalysis.dataHome.DataHome.main(DataHome.java:13)

1 个答案:

答案 0 :(得分:1)

嘿,好消息我能够解决这个问题。需要两个更改。首先,我编辑了solrconfig.xml以删除每个路径的额外选项卡,第二个更改是将jar从/ solr / contrib / extraction / lib复制到/ tomcat / web-inf / lib文件夹。 -