Sign up ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

I'm trying to run GlassFish 3.1.1 on Centos 6 in the Joyent cloud. No matter what I set the admin port to in glassfish/domains/domain1/config/domain.xml, when attempting to start it says:

There is a process already using the admin port XXXXX -- it probably is another instance of a GlassFish server.

I've checked netstat and /etc/services and tried dozens of different ports, but to no avail. It just flat out says that every port I try is taken.


share|improve this question
GlassFish reports any bind failure with this message. You should treat it as just "bind to port XXXXX failed for some reason". –  David Schwartz Feb 29 '12 at 11:48
Thanks for the tip. –  Steve Taylor Feb 29 '12 at 18:37

4 Answers 4

Have you checked your /etc/hosts configuration? it could be that you've recently changed your IP and left something like that ouy? is the hosts file is properly configured? (see Used/blocked ports in Ubuntu). is your hostname, dns working properly?

share|improve this answer
This is a fresh Joyent Cloud Centos 6 machine. Other software doesn't have a problem listening on ports in this configuration. It's only GlassFish that had a problem. However, I have reconfigured /etc/hosts to workaround the GlassFish issue and posted the solution. –  Steve Taylor Feb 29 '12 at 11:43
up vote 0 down vote accepted

I ended up modifying /etc/hosts to make it work.

Before:      localhost localhost.localdomain localhost4 localhost4.localdomain4
::1            localhost localhost.localdomain localhost6 localhost6.localdomain6

After: localhost localhost.localdomain localhost4 localhost4.localdomain4
::1            localhost localhost.localdomain localhost6 localhost6.localdomain6

I'm not really sure why I needed to do that, but it worked.

Disclaimer: This isn't really my IP address - just used it for this example.

share|improve this answer
Does work on the machine? Can you ping it? –  David Schwartz Feb 29 '12 at 11:46
Judging from your old hosts file, I might be inclined to guess that localhost was resolved to both IPv4 and IPv6 addresses, and maybe that's what making GlassFish unhappy. If you're still in the mood for tracking this one down, maybe you could try binding to "" instead of "localhost" in your GlassFish config. –  nickgrim Feb 29 '12 at 13:53
Also, it's obviously worth stressing that changing your hosts file like that might have obscure knock-on effects with other things on that box that expect "localhost" to resolve to the loopback interface. –  nickgrim Feb 29 '12 at 13:54
@nickgrim GlassFish was binding to which I tried changing to values such as, localhost, the public IP address and the private one, all to no avail. But you're probably right about localhost resolving to both an IPv4 and IPv6 address confusing it. I will look into it. Point taken regarding knock-on effects. Hopefully it doesn't have any security implications. –  Steve Taylor Feb 29 '12 at 18:33
@DavidSchwartz did work on the machine. That's what it was initially configured with and if it didn't work I couldn't ssh into it. –  Steve Taylor Feb 29 '12 at 18:35

I've seen similar behavior out of several commercial java apps in the past - it seems to be pretty common to not handle ipv6 capabilities very well, as well as not handling multiple NICs well.

Do use the guys as a resource - they're there to help, and glassfish is common enough that I'd like to see this Q FAQ-i-fied.


--e (@ joyent)

share|improve this answer
You work at joyent? –  Steve Taylor Mar 2 '12 at 7:33

This symptom occurs if your chosen host name does not resolve.

The host name is defined in /etc/sysconfig/network:

[root@funky glassfish]# cat /etc/sysconfig/network
# general networking
[root@funky glassfish]

Check if you can ping it:

[root@funky glassfish]# ping funky
ping: unknown host funky
[root@funky glassfish]#

If this is not the case and your IP address is static, edit /etc/hosts and add an entry for your hostname:

# IPv4 localhost funky

(use 'ifconfig eth0' to determine your ip)

Now ping will succeed and glassfish will start.

share|improve this answer
This is one possibility, but the more complete answer is that any bind failure generates this message, as pointed out in the question comments. –  HopelessN00b Nov 19 '12 at 12:30
As the questioner pointed out: 'every port is taken'. –  bebbo Nov 19 '12 at 22:26
So it's very unlikely that all ports are bound. Plus if the port is taken, there is a log entry in the server.log which shows you what's wrong and it would be easy to resolve. If the host name does not resolve, the server.log contains only the JVM parameters. –  bebbo Nov 19 '12 at 22:33

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.