1:如果你报这个错误,第一反应应该是本地的host文件没有配置服务器名称和对应的ip地址,这个反应就对了。贴一下错误和解决方法:
1 java.net.UnknownHostException: master 2 at java.net.Inet6AddressImpl.lookupAllHostAddr(Native Method) 3 at java.net.InetAddress$1.lookupAllHostAddr(Unknown Source) 4 at java.net.InetAddress.getAddressesFromNameService(Unknown Source) 5 at java.net.InetAddress.getAllByName0(Unknown Source) 6 at java.net.InetAddress.getAllByName(Unknown Source) 7 at java.net.InetAddress.getAllByName(Unknown Source) 8 at org.apache.zookeeper.client.StaticHostProvider.<init>(StaticHostProvider.java:60) 9 at org.apache.zookeeper.ZooKeeper.<init>(ZooKeeper.java:445) 10 at org.apache.zookeeper.ZooKeeper.<init>(ZooKeeper.java:380) 11 at com.bie.lesson01.ZookeeperClient.init(ZookeeperClient.java:35) 12 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 13 at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) 14 at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) 15 at java.lang.reflect.Method.invoke(Unknown Source) 16 at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50) 17 at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12) 18 at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47) 19 at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:24) 20 at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325) 21 at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78) 22 at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57) 23 at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290) 24 at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71) 25 at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288) 26 at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58) 27 at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268) 28 at org.junit.runners.ParentRunner.run(ParentRunner.java:363) 29 at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:86) 30 at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38) 31 at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:459) 32 at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:675) 33 at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:382) 34 at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:192)
解决办法如下:
在C:\WINDOWS\system32\drivers\etc\hosts文件末尾添加如下信息:
192.168.199.130 master 192.168.199.131 slaver1 192.168.199.132 slaver2 192.168.199.133 slaver3 192.168.199.134 slaver4 192.168.199.135 slaver5 192.168.199.136 slaver6
停更......
2017-11-18 17:08:50