UnknownHostException:XXX:Name or service not know

 

Java code:

InetAddress.getLocalHost();

An exception is thrown, the main error message is as follows:



 

 

Solution:

Find the /etc/hosts file and configure it:

127.0.0.1  XXX

 

Note: For the errors in the above figure, you need to configure:

127.0.0.1 caeit

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326181024&siteId=291194637