在Tomcat8.5发布dubbo-admin出现以下错误:
即dubbo-admin没有连上zookeeper.
ERROR curator.ConnectionState - Connection timed out for connection string (127.0.0.1:2181) and timeout (5000) / elapshttps://ask.csdn.net/questions/691453#ed (19803)
org.apache.curator.CuratorConnectionLossException: KeeperErrorCode = ConnectionLoss
at org.apache.curator.ConnectionState.checkTimeouts(ConnectionState.java:225)
at org.apache.curator.ConnectionState.getZooKeeper(ConnectionState.java:94)
at org.apache.curator.CuratorZookeeperClient.getZooKeeper(CuratorZookeeperClient.java:117)
at org.apache.curator.framework.imps.CuratorFrameworkImpl.getZooKeeper(CuratorFrameworkImpl.java:489)
at org.apache.curator.framework.imps.CreateBuilderImpl$11.call(CreateBuilderImpl.java:740)
at org.apache.curator.framework.imps.CreateBuilderImpl$11.call(CreateBuilderImpl.java:723)
at org.apache.curator.RetryLoop.callWithRetry(RetryLoop.java:109)
at org.apache.curator.framework.imps.CreateBuilderImpl.pathInForeground(CreateBuilderImpl.java:720)
at org.apache.curator.framework.imps.CreateBuilderImpl.protectedPathInForeground(CreateBuilderImpl.java:484)
at org.apache.curator.framework.imps.CreateBuilderImpl.forPath(CreateBuilderImpl.java:474)
at org.apache.curator.framework.imps.CreateBuilderImpl.forPath(CreateBuilderImpl.java:454)
at org.apache.curator.framework.imps.CreateBuilderImpl.forPath(CreateBuilderImpl.java:44)
at com.alibaba.dubbo.remoting.zookeeper.curator.CuratorZookeeperClient.createPersistent(CuratorZookeeperClient.java:74)
at com.alibaba.dubbo.remoting.zookeeper.support.AbstractZookeeperClient.create(AbstractZookeeperClient.java:63)
at com.alibaba.dubbo.registry.zookeeper.ZookeeperRegistry.doSubscribe(ZookeeperRegistry.java:149)
at com.alibaba.dubbo.registry.support.FailbackRegistry.retry(FailbackRegistry.java:377)
at com.alibaba.dubbo.registry.support.FailbackRegistry$1.run(FailbackRegistry.java:70)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:308)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:180)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:294)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
备注:
1.dubbo-admin的github下载地址为:https://github.com/apache/incubator-dubbo-ops
dubbo.properties配置文件内容为(未做修改过)
dubbo.registry.address=zookeeper://127.0.0.1:2181
dubbo.admin.root.password=root
dubbo.admin.guest.password=guest
2.dubbo-admin已正常启动,可正常访问http://localhost:8080/dubbo-admin-2.0.0/
3.zookeeper的版本的3.4.8,
4.操作系统为win10
5.验证zookeeper启动结果为:
查看端口占用情况:
C:\WINDOWS\system32>netstat -ano|findstr "2181"
TCP 0.0.0.0:2181 0.0.0.0:0 LISTENING 13908
TCP 127.0.0.1:2181 127.0.0.1:9049 CLOSE_WAIT 13908
TCP 127.0.0.1:2181 127.0.0.1:9062 CLOSE_WAIT 13908
TCP 127.0.0.1:2181 127.0.0.1:9082 ESTABLISHED 13908
TCP 127.0.0.1:9049 127.0.0.1:2181 FIN_WAIT_2 8340
TCP 127.0.0.1:9062 127.0.0.1:2181 FIN_WAIT_2 8340
TCP 127.0.0.1:9082 127.0.0.1:2181 ESTABLISHED 8340
TCP [::]:2181 [::]:0 LISTENING 13908
使用jps查看java进程情况:
C:\WINDOWS\system32>jps
13908 QuorumPeerMain
8340 Bootstrap
12376 Jps
8696 org.eclipse.equinox.launcher_1.3.201.v20161025-1711.jar
使用zookeeper客户端测试连接情况:
E:\zookeeper-3.4.8\bin>zkCli.cmd -server 127.0.0.1:2181
Connecting to 127.0.0.1:2181
2018-06-07 23:49:57,276 [myid:] - INFO [main:Environment@100] - Client environment:zookeeper.version=3.4.8--1, built on 02/06/2016 03:18 GMT
....
Welcome to ZooKeeper!
2018-06-07 23:49:57,598 [myid:] - INFO [main-SendThread(127.0.0.1:2181):ClientCnxn$SendThread@1032] - Opening socket connection to server 127.0.0.1/127.0.0.1:2181. Will not attempt to authenticate using SASL (unknown error)
2018-06-07 23:49:57,600 [myid:] - INFO [main-SendThread(127.0.0.1:2181):ClientCnxn$SendThread@876] - Socket connection established to 127.0.0.1/127.0.0.1:2181, initiating session
JLine support is enabled
[zk: 127.0.0.1:2181(CONNECTING) 0]