java.net.UnknownHostException: master

weixin_33816946發表於2017-11-18

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)
windows下開發大資料相關的應用程式,HBase部署在linux環境中,在執行除錯時可能會出現無法找到主機,類似異常資訊如上所貼:
解決辦法如下:
在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

相關文章