My original plan was to work on Linux. The only problem is, that my private computers in Vienna and Carinthia, as well as the laptop run Windows 7. This is mostly because two crucial pieces of my software don’t run on Linux: my image database IMatch and of course Photoshop.
Normally when I need Linux on my computers, I fire up Kubuntu in a VirtualBox, and while this works fine for my image upload scripts and the like, it is not such a good idea to run Eclipse and the GlassFish v3 application server in that environment. It’s not that it doesn’t work, but I don’t want to give the virtual box more than 1 GB of memory, and that’s definitely no environment that’s fun to work in.
On the other hand, when I tried to install the GlassFish Tools Bundle for Eclipse v1.2 (exactly what I use at work on Linux) under Windows 7, I quickly ran into a problem: Although everything installed just fine, I couldn’t start the integrated GlassFish v3 server from Eclipse. Some stack traces rushed by in the console view, and then a dialog told me that
Starting bundled GlassFish v3 Java EE 6 has encountered a problem. Wrong user name or password.
WTF?? This normally just works. Inspecting the console log revealed the real problem:
java.net.BindException: Address family not supported by protocol family
Also not exactly self-explanatory, especially along with that username/password dialog. Well, searching for the quote literally brought me to this discussion thread, and there I found the solution.
In Windows 7 (and seemingly Vista as well), the definition of localhost in Windows\System32\drivers\etc\hosts is in IPv6 notation, i.e. ::1 instead of 127.0.0.1, but trying to bind to localhost, GlassFish seemingly expects the IPv4 notation. I have no idea if there has been an update to GlassFish v3 in the meantime, but at least the bundle is still what was released on December 12. Hmm … one would expect such a bug to be highly unlikely to slip through quality control
Anyway. If you encounter the problem, just edit Windows\System32\drivers\etc\hosts and change ::1 to 127.0.0.1. I found no problem with Windows so far, and now GlassFish starts up happily. Just thought I’d have to share that.

This work, unless otherwise expressly stated, is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License.

Thank you, that’s very helpful. I’ve submitted a bug against glassfish on this (https://glassfish.dev.java.net/issues/show_bug.cgi?id=11677) but haven’t gotten any action there. Your workaround works for me.
Hi Franz,
I have since installed GlassFish v3 on two more computers, both running Windows 7 as well. In both cases the hosts file contained two lines, one for IPv4 and one for IPv6, and in both cases these two lines were even commented out. In both cases GlassFish started just fine.
The difference between my computer in Vienna and the two others, the laptop and the computer in Carinthia, is that only the computer in Vienna was upgraded from Vista to Windows 7, while the other two computers had been installed from scratch.
Likely conclusion: the problem affects only Vista and systems that were upgraded from Vista. That would also explain how the bug could have stayed undetected. When you test your program on a certain system, you always do a clean install
Had the same with Linux, where localhost was configured to listen to both 127.0.0.1 and ::1. Commenting out the IPv6 line did the trick. But it’s something that should be fixed in GlassFish. I hear it’s supposed to be fixed in GlassFish 3.1, but that doesn’t even start.
Thank you verry verry much dear Andreas. Now glassfish 3.1 work.
In the file you wrote, i uncomment these line:
# localhost name resolution is handled within DNS itself.
127.0.0.1 localhost
Im using Eclipse Helios, and the new glassfish plugin. Running on Windows 7 64 bit , JDK with the newest.
Gretting from Poland