tag:blogger.com,1999:blog-7360530862657754642.post130056070427547506..comments2022-11-23T05:11:11.380+01:00Comments on Leons Java Corner: Oracle Kills getLocalhost on MacOS X in Java 7Leon Rosenberghttp://www.blogger.com/profile/14281956158529281864noreply@blogger.comBlogger4125tag:blogger.com,1999:blog-7360530862657754642.post-39789257850416329792013-10-03T10:05:26.426+02:002013-10-03T10:05:26.426+02:00From the practical point of view it used to return...From the practical point of view it used to return the first address in /etc/hosts. For a multi-homed host you usually can pick one address as bind address, but using the first as default usually worked. Now it doesn't ;-)Leon Rosenberghttps://www.blogger.com/profile/14281956158529281864noreply@blogger.comtag:blogger.com,1999:blog-7360530862657754642.post-889441404298835202013-10-03T09:08:45.890+02:002013-10-03T09:08:45.890+02:00Leon, InetAddress.getLocalHost() is designed to gi...Leon, InetAddress.getLocalHost() is designed to give you the host's own address. But, really, what is a host's own address? This is - and has always been - a question that often have an ambiguous answer if you are on a multi-homed host. True that many people use the method and it works well for them in their little sandbox environment. But then you move your application to some bigger host that has 4 NICs and thus can be identified (accessed) by 4 different IP addresses ... then what?<br /><br />So I would argue that relying on InetAddress.getLocalHost() in the first place is simply wrong. znoggerhttps://www.blogger.com/profile/05123718683225207419noreply@blogger.comtag:blogger.com,1999:blog-7360530862657754642.post-46616448154641242482013-07-26T06:20:54.830+02:002013-07-26T06:20:54.830+02:00adding my local host name to /etc/hosts worked, wh...adding my local host name to /etc/hosts worked, whereas the VM option did not:<br /><br />127.0.0.1 localhost deep-thoughtJayenhttps://www.blogger.com/profile/12021457981837183160noreply@blogger.comtag:blogger.com,1999:blog-7360530862657754642.post-44476307511095697512012-08-29T20:57:09.555+02:002012-08-29T20:57:09.555+02:00As a workaround, add the following parameter
-Djav...As a workaround, add the following parameter<br />-Djava.nio.channels.spi.SelectorProvider=sun.nio.ch.KQueueSelectorProvider<br /><br />lghttps://www.blogger.com/profile/03276446107105069398noreply@blogger.com