A possible cause to this issue is that, the host name or host IP address cannot be retrieved correctly. To verify this assumption, run this command:
- If the host name cannot be output normally, the assumption is correct.
- Otherwise, this issue may have been caused by other reasons. Please open a ticket for technical support.
Follow these steps:
View the host name by running the following command on the machine that returned the error:
[root@iZ231wxgt6mZ ~]# hostname
If the command returns an error, check if an alias has been defined for the hostname, for example alias xxx=’hostname’ in .bash_profile or .bashrc. It is also possible that the command path is not under $PATH.
Ping the host:
[root@iZ231wxgt6mZ ~]# ping iZ231wxgt6mZ
If the host name is not pingable, bind the local IP address to the /etc/hosts file. Each ECS machine has a binding relationship between the local IP address and the host name by default, and do not remove it manually.
Confirm system configuration
Check if the hostname in /etc/sysconfig/network is consistent with the host name bound in /etc/hosts. If inconsistent, please modify it. After modifying the content in /etc/sysconfig/network, restart the machine for the modification to take effect. You’re not encouranged to modify configurations in a system file, because it may cause other exceptions.
After taking these three steps, the UnknownHostException exception will not be returned when the client starts.