InetAddress.getLocalHost().getHostAddress() 127.0.0.1

Today I wasted about 4 hours on this. I was running in to an issue because InetAddress.getLocalHost().getHostAddress() was returning “127.0.0.1” aka the loop back address and not the “real” IP address I expected. It sounds silly, but after hours of Google-ing and head banging it turns out the cause of this was a corrupt hosts file (which I had been looking at all day trying to figure out what I needed to do to it to make stuff work). The moral of the story is if you run in to this problem back up your current host file then replace it with a default one.