解决办法:java.net.SocketException: Address family not supported by protocol family:

阅读更多

 

java.net.SocketException: Address family not supported by protocol family: connect
 at sun.nio.ch.Net.connect(Native Method)
 at sun.nio.ch.SocketChannelImpl.connect(SocketChannelImpl.java:532)
 at org.apache.zookeeper.ClientCnxnSocketNIO.registerAndConnect(ClientCnxnSocketNIO.java:277)
 at org.apache.zookeeper.ClientCnxnSocketNIO.connect(ClientCnxnSocketNIO.java:287)
 at org.apache.zookeeper.ClientCnxn$SendThread.startConnect(ClientCnxn.java:1024)
 at org.apache.zookeeper.ClientCnxn$SendThread.run(ClientCnxn.java:1060)

 

方法1:设置hosts文件
使localhost指向IPV4地址127.0.0.1
127.0.0.1       localhost

 

方法2:设置JVM参数
-Djava.net.preferIPv4Stack=true

 

方法3:设置系统属性
System.setProperty("java.net.preferIPv4Stack", "true");

你可能感兴趣的:(dubbo,zookeeper)