Solve the problem Caused by: java.net.UnknownHostException

In Java, the "java.net.UnknownHostException" exception indicates that the hostname cannot be resolved. This means that the hostname you are trying to connect to cannot be resolved to an IP address. Possible reasons are:

  1. The hostname is wrong, please make sure the hostname entered is correct.
  2. Network connection problem, please check whether the network connection is normal.
  3. DNS problem, please check whether the DNS server can resolve the domain name normally.

If you can't solve this problem, you can try to use IP address instead of hostname. But this may make your code non-portable, because the IP address may change.

Guess you like

Origin blog.csdn.net/weixin_35748962/article/details/129598630