When kafka creates new consumers, it simply concatenate the name of your VM to generate the consumer id. So, your VM resolves localhost as the name of your VM, not whatever you had set. To solve, add kafka(or the name of VM) plus address to /etc/hosts
You have a different solution? A short tip here would help you and many other users who saw this issue last week.
- java.net.UnknownHostException: ajit-d18r738g60: ajit-d18r738g60 at java.net.InetAddress.getLocalHost(InetAddress.java:1308) at com.sun.enterprise.util.net.NetUtils.getCanonicalHostName(NetUtils.java:66) at com.sun.enterprise.util.ASenvPropertyReader.setSystemProperties(ASenvPropertyReader.java:161) at com.sun.enterprise.tools.launcher.ProcessLauncher.buildInternalCommand(ProcessLauncher.java:468) at com.sun.enterprise.tools.launcher.ProcessLauncher.buildCommand(ProcessLauncher.java:404) at com.sun.enterprise.tools.launcher.ProcessLauncher.process(ProcessLauncher.java:204) at com.sun.enterprise.tools.launcher.ProcessLauncher.main(ProcessLauncher.java:128)