2

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

我的代码如下:

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

1 回答 1

2

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

于 2014-02-05T01:12:01.630 回答