I have two redhat 6.3 machines, BOTH have no changes in /etc/hosts (ie. I have not added an ip address to them). On of my machines can run getLocalhost fine AND return the hostname a.domain.com. The other one fails with UnknownHostException.
Previously, I always added ip to /etc/hosts, but I am wondering why this one machine does not needs that. The /etc/nsswitch.conf on both machines has "hosts: files dns" so that is the same on both machines.
There is a big difference on the /etc/sysconfig/network-scripts/ifcfg-eth0 scripts. The node that gets UnknownHostException is something like this
DEVICE="eth0"
BOOTPROTO="static"
NM_CONTROLLED="yes"
ONBOOT="yes"
TYPE="Ethernet"
IPADDR=10.10.1.5
PREFIX=23
The one that works has something like this...
DEVICE="eth0"
HWADDR="AA:AA:AA:AA:3F:A8"
NM_CONTROLLED="yes"
ONBOOT=yes
TYPE=Ethernet
BOOTPROTO=none
DEFROUTE=yes
IPV4_FAILURE_FATAL=yes
IPV6INIT=no
NAME="System eth0"
IPADDR=10.10.1.2
PREFIX=23
GATEWAY=10.10.1.1
DNS1=10.20.100.100
DNS2=10.20.100.101
DOMAIN="domain.com sub.domain.com"
Could this somehow be the cause? or what other files can I look at to see why this is not working? I assume java is making some linux getLocalHost api call into the machine to get the hostname.
thanks,
Dean
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…