SolrCloud与Zookeeper异常“没有Zk stateReader”连接

时间:2018-09-25 09:30:40

标签: java solr apache-zookeeper solrj

Solrj与群集中的3个solr节点连接时遇到很大的问题。

这是我的代码:

    client = new CloudSolrClient.Builder().withZkHost("zoo1:2181,zoo2:2181,zoo3:2181").build();
client.connect();
QueryRequest qr = new QueryRequest(sq);
qr.setBasicAuthCredentials("USER", "PASSWORD");
QueryResponse response = qr.process(client);  <----- ERROR

我也尝试过

client = new CloudSolrClient.Builder().withSolrUrl("solr1:8983,solr2:8983,solr3:8983").build();

在本地启动测试方法,一切都很好,响应还可以。 但是当我在服务器上部署战争调用服务时,会出现异常

java.lang.IllegalStateException:没有Zk stateReader         在org.apache.solr.client.solrj.impl.CloudSolrClient.getZkStateReader(CloudSolrClient.java:345)〜[solr-solrj-7.4.0.jar:7.4.0 9060ac689c270b02143f375de0348b7f626adebc-jpountz-2018-06-18 16:55 :14]         在it.wedoo.mmoutlet.dao.VehicleRepositoryImpl.findByQuery(VehicleRepositoryImpl.java:66)〜[mmoutlet-dao-1.0-SNAPSHOT.jar :?]         在it.wedoo.mmoutlet.service.MMOutletService.getVehicles(MMOutletService.java:324)[mmoutlet-service-1.0-SNAPSHOT.jar :?]         at.wedoo.mmoutlet.rest.controller.SelectController.getVehicles(SelectController.java:100)[classes / :?]         在jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(本机方法)〜[?:?]         在jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)〜[?:?]         在jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)〜[?:?]         在java.lang.reflect.Method.invoke(Method.java:564)〜[?:?]         在org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:209)[spring-web-5.0.7.RELEASE.jar:5.0.7.RELEASE]         在org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:136)[spring-web-5.0.7.RELEASE.jar:5.0.7.RELEASE]         在org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:102)[spring-webmvc-5.0.7.RELEASE.jar:5.0.7.RELEASE]         在org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:877)上[spring-webmvc-5.0.7.RELEASE.jar:5.0.7.RELEASE]         在org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:783)上[spring-webmvc-5.0.7.RELEASE.jar:5.0.7.RELEASE]         在org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:87)上[spring-webmvc-5.0.7.RELEASE.jar:5.0.7.RELEASE]         在org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:991)上[spring-webmvc-5.0.7.RELEASE.jar:5.0.7.RELEASE]         在org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:925)[spring-webmvc-5.0.7.RELEASE.jar:5.0.7.RELEASE]         在org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:974)[spring-webmvc-5.0.7.RELEASE.jar:5.0.7.RELEASE]         在org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:877)[spring-webmvc-5.0.7.RELEASE.jar:5.0.7.RELEASE]         在javax.servlet.http.HttpServlet.service(HttpServlet.java:661)[tomcat8-servlet-api-8.5.30.jar :?]         在org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:851)[spring-webmvc-5.0.7.RELEASE.jar:5.0.7.RELEASE]         在javax.servlet.http.HttpServlet.service(HttpServlet.java:742)[tomcat8-servlet-api-8.5.30.jar :?]         在org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:231)[tomcat8-catalina-8.5.30.jar:8.5.30]         在org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)[tomcat8-catalina-8.5.30.jar:8.5.30]         在org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)[tomcat8-websocket-8.5.30.jar:8.5.30]         在org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)[tomcat8-catalina-8.5.30.jar:8.5.30]         在org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)[tomcat8-catalina-8.5.30.jar:8.5.30]         在org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:199)[tomcat8-catalina-8.5.30.jar:8.5.30]         在org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:96)[tomcat8-catalina-8.5.30.jar:8.5.30]         在org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:496)[tomcat8-catalina-8.5.30.jar:8.5.30]         在org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:140)[tomcat8-catalina-8.5.30.jar:8.5.30]         在org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:81)[tomcat8-catalina-8.5.30.jar:8.5.30]         在org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:650)[tomcat8-catalina-8.5.30.jar:8.5.30]         在org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:87)[tomcat8-catalina-8.5.30.jar:8.5.30]         在org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:342)[tomcat8-catalina-8.5.30.jar:8.5.30]         在org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:803)[tomcat8-coyote-8.5.30.jar:8.5.30]         在org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66)[tomcat8-coyote-8.5.30.jar:8.5.30]         在org.apache.coyote.AbstractProtocol $ ConnectionHandler.process(AbstractProtocol.java:800)[tomcat8-coyote-8.5.30.jar:8.5.30]         在org.apache.tomcat.util.net.NioEndpoint $ SocketProcessor.doRun(NioEndpoint.java:1463)[tomcat8-土狼-8.5.30.jar:8.5.30]         在org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)[tomcat8-土狼-8.5.30.jar:8.5.30]         在java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1135)[?:?]         在java.util.concurrent.ThreadPoolExecutor $ Worker.run(ThreadPoolExecutor.java:635)[?:?]         在org.apache.tomcat.util.threads.TaskThread $ WrappingRunnable.run(TaskThread.java:61)[tomcat8-util-8.5.30.jar:8.5.30]         在java.lang.Thread.run(Thread.java:844)[?:?] 11:14:36.732 [http-nio-8080-exec-1]错误it.wedoo.mmoutlet.entity.Error-源运行时引发错误,并带有错误消息此消息没有Zk stateReader

我真的不知道该如何处理。

版本:

Solr 7.4 SolrJ 7.4 动物园管理员3.4.13

谢谢您的帮助!

0 个答案:

没有答案