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.