Reputation: 8640
On our deployment systems we are using Java to get the fully qualified domain name for the deployment machine we're using.
We're using the following method: https://docs.oracle.com/javase/8/docs/api/java/net/InetAddress.html#getCanonicalHostName--
After moving to new servers we have issue related to systemd that it doesn't resolve the domain :
Caused by: java.net.UnknownHostException: *machineName*: Name or service not known
This is the only difference between the old lab we used and the new one that our IT department could think of.
I've looked online for 2 days for any solution but couldn't find what is the best course of action.
Any ideas?
Edit question:
Some outputs I've tried -
root@myd-vm11924:~# hostname
myd-vm11924
root@myd-vm11924:~# hostname -a
hostname: Name or service not known
root@myd-vm11924:~# hostnamectl
Static hostname: myd-vm11924
Icon name: computer-vm
Chassis: vm
Boot ID: ef97951ccad04febb9856013e750e9ee
Virtualization: vmware
Operating System: Ubuntu 14.04.2 LTS
Kernel: Linux 3.13.0-24-generic
Architecture: x86_64
root@myd-vm11924:~#
TIA.
Upvotes: 0
Views: 414
Reputation: 13411
First I would reality check that other tools are returning the hostname as expected. In particular, the legacy Hostname reporting tool:
hostname
And the new systemd-specific tool for this:
hostnamectl
If these report the right answer and Java doesn't, you have the possibility of adding a workarond in your code to make a system call to these tools which return the correct response.
Otherwise, you can file a bug with your Java tools provider.
Upvotes: 1