SOLR:无法重复未缓冲的实体封闭请求

时间:2012-09-14 05:58:03

标签: solr indexing solrj

运行索引时出现以下错误。我正在使用Solr 1.4。 从1天开始,我一直在努力了解这个问题的根本原因,但事实并非如此。 请帮我解决这个问题。

Caused by: org.apache.solr.client.solrj.SolrServerException:
org.apache.commons.httpclient.ProtocolException: Unbuffered entity enclosing request can not be repeated.at 
org.apache.solr.client.solrj.impl.CommonsHttpSolrServer.request(CommonsHttpSolrServer.java:469) at
org.apache.solr.client.solrj.impl.CommonsHttpSolrServer.request(CommonsHttpSolrServer.java:243) at
org.apache.solr.client.solrj.request.AbstractUpdateRequest.process(AbstractUpdateRequest.java:105) at       
org.apache.solr.client.solrj.SolrServer.add(SolrServer.java:49)
 ... 3 more
Caused by: org.apache.commons.httpclient.ProtocolException: Unbuffered entity enclosing request can not be repeated.     at
org.apache.commons.httpclient.methods.EntityEnclosingMethod.writeRequestBody(EntityEnclosingMethod.java:487)     at
org.apache.commons.httpclient.HttpMethodBase.writeRequest(HttpMethodBase.java:2114)     at
org.apache.commons.httpclient.HttpMethodBase.execute(HttpMethodBase.java:1096)     at
org.apache.commons.httpclient.HttpMethodDirector.executeWithRetry(HttpMethodDirector.java:398)     at
org.apache.commons.httpclient.HttpMethodDirector.executeMethod(HttpMethodDirector.java:171)     at
org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:397)     at
org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:323)     at
org.apache.solr.client.solrj.impl.CommonsHttpSolrServer.request(CommonsHttpSolrServer.java:416)
... 7 more

以下是代码:

Collection<SolrInputDocument> docs = new ArrayList<SolrInputDocument>();

CommonsHttpSolrServer server = new CommonsHttpSolrServer(solrHost);
server.setDefaultMaxConnectionsPerHost(150);
server.setRequestWriter(new BinaryRequestWriter());

SolrInputDocument solrDoc = new SolrInputDocument();
solrDoc.addField("id", "1234");
docs.add(solrDoc);

try {
   server.add(docs);
   server.commit();
} catch (SolrServerException e) {
   throw new SolrException(e.getMessage());
}

0 个答案:

没有答案