1:如果有一天,你有幸看到了这个错误,也许你像我一样low,因为此时,你已经准备开发Zookeeper程序了,却还没有把Zookeeper的服务启动起来。
1 org.apache.zookeeper.KeeperException$ConnectionLossException: KeeperErrorCode = ConnectionLoss for /eclipse20171118 2 at org.apache.zookeeper.KeeperException.create(KeeperException.java:99) 3 at org.apache.zookeeper.KeeperException.create(KeeperException.java:51) 4 at org.apache.zookeeper.ZooKeeper.create(ZooKeeper.java:783) 5 at com.bie.lesson01.ZookeeperClient.zookeeperCreate(ZookeeperClient.java:51) 6 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 7 at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) 8 at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) 9 at java.lang.reflect.Method.invoke(Unknown Source) 10 at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50) 11 at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12) 12 at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47) 13 at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17) 14 at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26) 15 at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325) 16 at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78) 17 at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57) 18 at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290) 19 at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71) 20 at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288) 21 at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58) 22 at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268) 23 at org.junit.runners.ParentRunner.run(ParentRunner.java:363) 24 at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:86) 25 at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38) 26 at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:459) 27 at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:675) 28 at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:382) 29 at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:192)
解决办法,启动你的Zookeeper。记得启动起来以后进行查看。
如果你的Zookeeper启动起来了,还报这个错误,那么就是关闭防火墙即可。
CentOS Linux开启和关闭防火墙命令有两种,一种是临时的,重启即复原;另外一种是永久性的,重启不会复原。 1) 临时生效,重启后复原 开启: service iptables start 关闭: service iptables stop 2) 永久性生效,重启后不会复原 开启: chkconfig iptables on 关闭: chkconfig iptables off
停更.......
2017-11-18 17:12:35