users@glassfish.java.net

Odd permission issue starting GF on Mac OS X

From: Noah White <emailnbw_at_gmail.com>
Date: Mon, 17 Sep 2012 21:25:39 -0400

I'm running Mac OS X 10.8.1 (Mountain Lion) and I usually start Glassfish (3.1.2.2) as a non-root user with asadmin. That was working great until the other day. Then all of a sudden I started getting the following error:

"There is a process already using the admin port 4848 -- it probably is another instance of a GlassFish server.
Command start-domain failed."

The thing is there isn't anything running on 4848.

Finally, I tried running asadmin with sudo like so:

sudo ./asadmin start-domain domain1

Et voila that worked. Except for the fact that this has never required root privs before! So that got me thinking and the only other change I'd made recently was I set my host name which up until that point was the default one set when I installed Mountain Lion. The procedure I used to set my host name was to run scutil like so:

sudo scutil --set HostName MyNewHostName

So I decided to try to roll that change back and I ran:

sudo scutil --set HostName

That cleared the host name and the hostname command now returns the default one. Once I did that I was able to start GF w/asadmin without need the sudo.

Any thoughts on this one? It seems to me that at the very least the error GF is reporting in this case is misleading. Perhaps the underlying cause is a general connection refused exception when it tries to bind to the port vs. a permissions exception and that why it reports the error as it does, but if the underlying cause is a permissions one then I think GF should report a more accurate message in response.

-Noah