连接zookeeper报错

09:48:41,517  INFO ZooKeeper:100 - Client environment:user.name=cheng
09:48:41,517  INFO ZooKeeper:100 - Client environment:user.home=C:\Users\cheng
09:48:41,518  INFO ZooKeeper:100 - Client environment:user.dir=E:\eclipseworkspace01\pinyougou-parent\pinyougou-search-service
09:48:41,519  INFO ZooKeeper:438 - Initiating client connection, connectString=192.168.25.130:2881,192.168.25.130:2882,192.168.25.130:2883 sessionTimeout=60000 watcher=org.I0Itec.zkclient.ZkClient@25275eea
09:48:41,541  INFO ClientCnxn:1032 - Opening socket connection to server 192.168.25.130/192.168.25.130:2883. Will not attempt to authenticate using SASL (unknown error)
09:48:42,550  WARN ClientCnxn:1162 - Session 0x0 for server null, unexpected error, closing socket connection and attempting reconnect
java.net.ConnectException: Connection refused: no further information
    at sun.nio.ch.SocketChannelImpl.checkConnect(Native Method)
    at sun.nio.ch.SocketChannelImpl.finishConnect(SocketChannelImpl.java:717)
    at org.apache.zookeeper.ClientCnxnSocketNIO.doTransport(ClientCnxnSocketNIO.java:361)
    at org.apache.zookeeper.ClientCnxn$SendThread.run(ClientCnxn.java:1141)
09:48:42,662  INFO ClientCnxn:1032 - Opening socket connection to server 192.168.25.130/192.168.25.130:2882. Will not attempt to authenticate using SASL (unknown error)
09:48:42,662  INFO ClientCnxn:876 - Socket connection established to 192.168.25.130/192.168.25.130:2882, initiating session
09:48:46,541  INFO ZkEventThread:82 - Terminate ZkClient event thread.
09:49:02,664  WARN ClientCnxn:1108 - Client session timed out, have not heard from server in 20002ms for sessionid 0x0
09:49:02,768  INFO ZooKeeper:684 - Session: 0x0 closed
09:49:02,772  WARN XmlWebApplicationContext:546 - Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.jms.listener.DefaultMessageListenerContainer#0' defined in file [E:\eclipseworkspace01\pinyougou-parent\pinyougou-search-service\target\classes\spring\applicationContext-jms-consumer.xml]: Cannot resolve reference to bean 'itemSearchListener' while setting bean property 'messageListener'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'itemSearchListener': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private com.pinyougou.search.service.ItemSearchService com.pinyougou.search.service.impl.ItemSearchListener.itemSearchService; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'itemSearchServiceImpl' defined in file [E:\eclipseworkspace01\pinyougou-parent\pinyougou-search-service\target\classes\com\pinyougou\search\service\impl\ItemSearchServiceImpl.class]: Initialization of bean failed; nested exception is org.I0Itec.zkclient.exception.ZkTimeoutException: Unable to connect to zookeeper server within timeout: 5000
09:49:02,776  INFO ClientCnxn:519 - EventThread shut down for session: 0x0
09:49:02,780 ERROR ContextLoader:353 - Context initialization failed

错误原因:eclipse中连接zookeeper端口错误,应该配置为zoo.cfg中clientPort,而不是zookeeper集群之间通信的端口。
zookeeper集群中涉及到3个端口 zoo.cfg中: server.1=192.168.25.130:2881:3881,2881是zookeeper通信端口,3881是选举端口,clienPort是客户端连连接zookeeper端口

猜你喜欢

转载自blog.csdn.net/qq_27252133/article/details/80645008