Project error on Linux unable to find hostname solution

Source: Internet
Author: User


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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.