1

我正在尝试使用 solrJ 访问 solr 服务器

  1. 我在子域 search.xxx.com 中部署了 solr,并尝试使用 solrj 客户端索引一些数据。但我在 Tomcat 7 的 catalina.out 中收到“需要长度”。
  2. 当我开发它时,它在我的本地设置中运行良好。
  3. 查询成功,即使返回0个doc。
  4. 即使我转储它并使用数据导入处理程序(xml),我怎样才能动态更新文档。

下面是我得到的 catalina.out 错误:

org.apache.solr.common.SolrException: Length Required

Length Required

request: http://search.xxx.com/solr/product_mobile/update/javabin?wt=javabin&version=2
    at org.apache.solr.client.solrj.impl.CommonsHttpSolrServer.request(CommonsHttpSolrServer.java:432)
    at org.apache.solr.client.solrj.impl.CommonsHttpSolrServer.request(CommonsHttpSolrServer.java:246)
    at org.apache.solr.client.solrj.request.AbstractUpdateRequest.process(AbstractUpdateRequest.java:105)
    at org.apache.solr.client.solrj.SolrServer.add(SolrServer.java:69)
    at org.apache.solr.client.solrj.SolrServer.add(SolrServer.java:54)
    at com.xxx.product.solrclient.SolrConnection.indexListOfDocuments(SolrConnection.java:183)
    at com.xxx.product.solrclient.SolrOperations.reloadDataIntoSolrIndex(SolrOperations.java:169)
    at com.xxx.product.servlets.AjaxCallHandlerServlet.reloadSolrIndex(AjaxCallHandlerServlet.java:235)
    at com.xxx.product.servlets.AjaxCallHandlerServlet.doPost(AjaxCallHandlerServlet.java:140)
    at com.xxx.product.servlets.AjaxCallHandlerServlet.doGet(AjaxCallHandlerServlet.java:64)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:621)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:304)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
    at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:684)
    at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:471)
    at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:402)
    at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:329)
    at com.inspion.product.servlets.ProductFrontControllerServlet.doGet(ProductFrontControllerServlet.java:62)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:621)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:304)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
    at com.inspion.product.filters.ProductRequestValidatorFilter.doFilter(ProductRequestValidatorFilter.java:49)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:224)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
    at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:164)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:100)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:405)
    at org.apache.coyote.http11.Http11AprProcessor.process(Http11AprProcessor.java:261)
    at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:515)
    at org.apache.tomcat.util.net.AprEndpoint$SocketWithOptionsProcessor.run(AprEndpoint.java:1731)
    at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
    at java.lang.Thread.run(Thread.java:619)
4

1 回答 1

0

这不是一个完整的答案(我还不能在 stackoverflow 中“评论”)。

solrservlet 似乎没有回答您的 solrj 请求,而是错误页面或其他内容。search.xxx.com 前面有网络服务器吗?

您可能希望从 tomcat 服务器的系统输出/错误日志开始,以获取服务器端异常。这会有所帮助。

于 2012-06-13T13:30:31.820 回答