Issue 1:
[√] I have searched the issues of this repository and believe that this is not a duplicate.

[√] I have checked the FAQ of this repository and believe that this is not a duplicate.

Environment

Dubbo version: 2.7.4.1

Operating System version: Windows 10 1809 64位专业版

Java version: 1.8.0.191

Nacos version: 1.1.3

Steps to reproduce this issue

前提：

1，Windows 10 专业版启用Hyper-v，安装Docker for windows，但是Docker服务没启动

2，C:\Windows\System32\drivers\etc\hosts 中已设置了: 正确IP 主机名

网卡环境：

添加JVM参数“-Djava.net.preferIPv4Stack=true”，然后运行以下代码(从dubbo-2.7.4.1-sources.jar中复制的NetUtils.getLocalAddress()相关的代码)：

import java.io.IOException;
import java.net.Inet6Address;
import java.net.InetAddress;
import java.net.NetworkInterface;
import java.net.UnknownHostException;
import java.util.Enumeration;
import java.util.Optional;
import java.util.regex.Pattern;

public class Test {

private static final Pattern IP_PATTERN = Pattern.compile("\\d{1,3}(\\.\\d{1,3}){3,5}$");

private static final String ANYHOST_VALUE = "0.0.0.0";

private static final String LOCALHOST_VALUE = "127.0.0.1";

public static void main(String[] args) throws UnknownHostException {

System.out.println(getIpByHost(getLocalAddress().getHostName()));

}

public static String getIpByHost(String hostName) {
try {
return InetAddress.getByName(hostName).getHostAddress();
} catch (UnknownHostException e) {
return hostName;
}
}

public static InetAddress getLocalAddress() {

InetAddress localAddress = getLocalAddress0();
return localAddress;
}

private static InetAddress getLocalAddress0() {
InetAddress localAddress = null;
try {
localAddress = InetAddress.getLocalHost();
Optional<InetAddress> addressOp = toValidAddress(localAddress);
if (addressOp.isPresent()) {
return addressOp.get();
}
} catch (Throwable e) {
e.printStackTrace();
}

try {
Enumeration<NetworkInterface> interfaces = NetworkInterface.getNetworkInterfaces();
if (null == interfaces) {
return localAddress;
}
while (interfaces.hasMoreElements()) {
try {
NetworkInterface network = interfaces.nextElement();
if (network.isLoopback() || network.isVirtual() || !network.isUp()) {
continue;
}
Enumeration<InetAddress> addresses = network.getInetAddresses();
while (addresses.hasMoreElements()) {
try {
Optional<InetAddress> addressOp = toValidAddress(addresses.nextElement());
if (addressOp.isPresent()) {
try {
if(addressOp.get().isReachable(100)){
return addressOp.get();
}
} catch (IOException e) {
// ignore
}
}
} catch (Throwable e) {
e.printStackTrace();
}
}
} catch (Throwable e) {
e.printStackTrace();
}
}
} catch (Throwable e) {
e.printStackTrace();
}
return localAddress;
}

private static Optional<InetAddress> toValidAddress(InetAddress address) {
if (address instanceof Inet6Address) {
Inet6Address v6Address = (Inet6Address) address;
if (isPreferIPV6Address()) {
return Optional.ofNullable(normalizeV6Address(v6Address));
}
}
if (isValidV4Address(address)) {
return Optional.of(address);
}
return Optional.empty();
}

static boolean isPreferIPV6Address() {
boolean preferIpv6 = Boolean.getBoolean("java.net.preferIPv6Addresses");
if (!preferIpv6) {
return false;
}
return false;
}

static InetAddress normalizeV6Address(Inet6Address address) {
String addr = address.getHostAddress();
int i = addr.lastIndexOf('%');
if (i > 0) {
try {
return InetAddress.getByName(addr.substring(0, i) + '%' + address.getScopeId());
} catch (UnknownHostException e) {
// ignore
e.printStackTrace();
}
}
return address;
}

static boolean isValidV4Address(InetAddress address) {
if (address == null || address.isLoopbackAddress()) {
return false;
}
String name = address.getHostAddress();
boolean result = (name != null
&& IP_PATTERN.matcher(name).matches()
&& !ANYHOST_VALUE.equals(name)
&& !LOCALHOST_VALUE.equals(name));
return result;
}
}

Pls. provide [GitHub address] to reproduce this issue.

Expected Result

获取的IP应该是在C:\Windows\System32\drivers\etc\hosts 中已设置的正确IP

Actual Result

添加“-Djava.net.preferIPv4Stack=true”参数之后，输出的IP是Hyper-V的虚拟网卡vEthernet (Default Switch)的IP，注册到Nacos的也是这个IP

去掉“-Djava.net.preferIPv4Stack=true”参数之后，输出的IP才是在C:\Windows\System32\drivers\etc\hosts 中已设置的正确IP

调试过程中发现，如果添加“-Djava.net.preferIPv4Stack=true”参数，则调用链是:

"main@1" prio=5 tid=0x1 nid=NA runnable
java.lang.Thread.State: RUNNABLE
at java.net.Inet4AddressImpl.lookupAllHostAddr(Inet4AddressImpl.java:-1)
at java.net.InetAddress$2.lookupAllHostAddr(InetAddress.java:929)
at java.net.InetAddress.getAddressesFromNameService(InetAddress.java:1324)
at java.net.InetAddress.getLocalHost(InetAddress.java:1501)

最后获取到的IP是Hyper-V的虚拟网卡的IP

如果去掉“-Djava.net.preferIPv4Stack=true”参数，则调用链是:

"main@1" prio=5 tid=0x1 nid=NA runnable
java.lang.Thread.State: RUNNABLE
at java.net.Inet6AddressImpl.lookupAllHostAddr(Inet6AddressImpl.java:-1)
at java.net.InetAddress$2.lookupAllHostAddr(InetAddress.java:929)
at java.net.InetAddress.getAddressesFromNameService(InetAddress.java:1324)
at java.net.InetAddress.getLocalHost(InetAddress.java:1501)

最后获取到的IP是在C:\Windows\System32\drivers\etc\hosts 中已设置的正确IP

Issue 2:
I have searched the issues of this repository and believe that this is not a duplicate.

I have checked the FAQ of this repository and believe that this is not a duplicate.

Environment

Dubbo version: master分支

Operating System version: windows

Java version: JDK1.8

Steps to reproduce this issue

在spi service配置中配置

impl,implMultiName=org.apache.dubbo.common.extension.ext10.impl.Ext10MultiNamesImpl

ExtensionLoaderTest中加测试用例

Ext10MultiNames ext10MultiNames = ExtensionLoader.getExtensionLoader(Ext10MultiNames.class).getExtension("impl");

Assertions.assertNotNull(ext10MultiNames);

3.运行不通过

Expected Result

应该获取到对应的实现

Actual Result

获取到空，测试不通过