You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
if (result == null) { // If not found, try to get the first one
for (NetworkInterface networkInterface : validNetworkInterfaces) {
Enumeration<InetAddress> addresses = networkInterface.getInetAddresses();
while (addresses.hasMoreElements()) {
Optional<InetAddress> addressOp = toValidAddress(addresses.nextElement());
if (addressOp.isPresent()) {
try {
if (addressOp.get().isReachable(100)) {
return networkInterface;
}
} catch (IOException e) {
// ignore
}
}
}
}
}
改为:
if (result == null) { // If not found, try to get the first one
for (NetworkInterface networkInterface : validNetworkInterfaces) {
Enumeration<InetAddress> addresses = networkInterface.getInetAddresses();
while (addresses.hasMoreElements()) {
Optional<InetAddress> addressOp = toValidAddress(addresses.nextElement());
if (addressOp.isPresent()) {
try {
if (addressOp.get().isReachable(100)) {
result = networkInterface;
break;
}
} catch (IOException e) {
// ignore
}
}
}
}
}
The text was updated successfully, but these errors were encountered:
Environment
docker swarm环境下从2.7.14版本开始获取的是本地虚拟网桥段的地址,获取的IP地址只能够在宿主机上访问,跨主机是不能访问的。2.7.14版本之前能获取到容器swarm网络的IP。
暂时解决办法,重写了org.apache.dubbo.common.utils.NetUtils类。
修改dubbo/dubbo-common/src/main/java/org/apache/dubbo/common/utils/NetUtils.java 的428-444行,如下:
改为:
The text was updated successfully, but these errors were encountered: