ACTIVEMQ Common error Three: caused By:java.net.UnknownHostException:centos: unknown name or service

Source: Internet
Author: User


The error message at ACTIVEMQ startup is as follows:


Caused By:java.net.UnknownHostException:centos: unknown name or service
At Java.net.Inet6AddressImpl.lookupAllHostAddr (Native method)
At Java.net.inetaddress$1.lookupallhostaddr (inetaddress.java:866)
At Java.net.InetAddress.getAddressesFromNameService (inetaddress.java:1258)

At Java.net.InetAddress.getLocalHost (inetaddress.java:1434)






Problem Analysis:


According to the log Java.net.UnknownHostException:localhost judge, should be due to the server can not correctly resolve localhost caused by


[Plain] View plain copy
[123@test conf]$ ping localhost
Ping:unknown host localhost
[123@test conf]$ Ping 127.0.0.1
PING 127.0.0.1 (127.0.0.1) bytes of data.
Bytes from 127.0.0.1:icmp_seq=1 ttl=64 time=0.020 ms
Bytes from 127.0.0.1:icmp_seq=2 ttl=64 time=0.026 ms
Bytes from 127.0.0.1:icmp_seq=3 ttl=64 time=0.023 ms
Based on log error creating Bean with Name ' Org.apache.activemq.xbean.XBeanBrokerService ' defined in class path resource [ACTIVEMQ . xml] Judgment, it should be an error in the Brokerservice configuration in the Activemq.xml file
Solution Method:


One: Do not use localhost and use 127.0.0.1 instead


Second: New host mapping
[Root@test test]# vi/etc/hosts
192.168.1.104 Centos.localdomain CentOS


[Root@test test]# Ping CentOS
PING centos.localdomain (127.0.0.1) bytes of data.
Bytes from Centos.localdomain (127.0.0.1): icmp_seq=1 ttl=64 time=0.019 ms
Bytes from Centos.localdomain (127.0.0.1): icmp_seq=2 ttl=64 time=0.020 ms
Bytes from Centos.localdomain (127.0.0.1): icmp_seq=3 ttl=64 time=0.024 ms
Bytes from Centos.localdomain (127.0.0.1): icmp_seq=4 ttl=64 time=0.020 ms
Bytes from Centos.localdomain (127.0.0.1): icmp_seq=5 ttl=64 time=0.018 ms



You can use CentOS in the configuration file at this time, and the server resolves CentOS to 127.0.0.1


Solve this problem.

Related Article

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.