macOS上,eclipse运行java项目报错:

java.net.UnknownHostException: chendeMacBook-Pro.local: chendeMacBook-Pro.local: nodename nor servname provided, or not known
	at java.net.InetAddress.getLocalHost(InetAddress.java:1473)
	at com.paladin.core.sys.system.controller.SystemController.login(SystemController.java:342)
	at com.paladin.core.sys.system.controller.SystemController$$FastClassBySpringCGLIB$$b003e56.invoke(<generated>)
	at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:204)
	...

解决方法:http://blog.csdn.net/longyuhome/article/details/50674442

1). sudo vi /private/etc/hosts 2). 将主机名加上 127.0.0.1 chendeMacBook-Pro.local 3). 在终端中输入刷新的命令dscacheutil -flushcache