Project error cannot find host name solution
Sometimes our project is running locally without problems, but it's a mistake to deploy to a Linux server.
Error: Java.net.UnknownHostException: hostname: hostname cannot find host name.
Workaround:
Modify the/etc/hosts file on the server
127.0.0.1 localhost localhost.localdomain Add the desired host name
Or
127.0.0.1 localhost Localhost.localdomain
127.0.0.1 Add the desired host name
If you want to modify the host name, you need to modify
Vi/etc/sysconfig/network file
Networking=yes
Hostname=localhost.localdomain
Localhost.localdomain Replace the name you want to change
Reboot is required after hostname change to take effect
Input reboot restart, restart good input hostname view, found hostname has changed
In addition, temporarily changing the hostname can be changed temporarily with the command hostname newhostname to avoid restarting.
This article from "The Heart has the tiger, the fine smell Rose" the blog, please must keep this source http://zhangdongxu.blog.51cto.com/12029530/1915726
Project error on Linux unable to find hostname solution