users@glassfish.java.net

Re: Odd permission issue starting GF on Mac OS X

From: Lachezar Dobrev <l.dobrev_at_gmail.com>
Date: Tue, 18 Sep 2012 23:40:23 +0300

  You may get a permission denied, because you tried to bind to a
different host name, not because the port is already bound. Maybe you
can check if there are any remnants of the old name in domain.xml?
  It may also be due to lingering name resolution issues...
  For instance... You may have the old name standing against 127.0.0.1
in /etc/hosts...

2012/9/18 Noah White <emailnbw_at_gmail.com>:
> Tom, thanks for the info. In this case the underlying cause seems to be a
> permissions issue vs. a name resolution one since it bound fine when I used
> 'sudo' to run asadmin.
>
> -Noah
>
> On Sep 18, 2012, at 11:33 AM, Tom Mueller <tom.mueller_at_oracle.com> wrote:
>
> It is the case that GlassFish tries to bind to port 4848 as a listener, and
> if it fails, it reports this message even if the real reason it could not
> bind was not because there is another server listening on the port. There
> are other situations that can cause GlassFish to be unable to bind to that
> port, including certain name resolution issues.
>
> Tom
>
> On 9/17/2012 8:25 PM, Noah White wrote:
>
>
> 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
>
>
>
>