[SPARK-4475] change "localhost" to "127.0.0.1" if "localhost" can't be resolved

This will fix [SPARK-4475]

Simply change "localhost" to equivalent "127.0.0.1" will solve the issue.