Take the 2-minute tour ×
Server Fault is a question and answer site for professional 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.

Ideas?

share|improve this question
1  
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
add comment

5 Answers

1. Identify the process

You can find out what process is listening on this specific port.

lsof -i :8080

2. Find out more information about the process

The location of the executable and its parameters. In case of a Java process, you should be able to identify classpath in the parameters.

ps -ef | grep PID_FOUND

.. Or by using Jps which print Main Class and arguments.

jps -mlv | grep PID_FOUND
share|improve this answer
    
I found free ports using a variety of methods, such as the above, but it didn't work. It might have something to do with the Joyent Cloud machines having two network interfaces combined with the code that Grizzly uses to listen on a port. –  Steve Taylor Feb 20 '12 at 15:58
add comment

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
add comment
up vote 0 down vote accepted

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

Before:

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

After:

199.192.240.10 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 127.0.0.1 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 "127.0.0.1" instead of "localhost" in your GlassFish config. –  nickgrim Feb 29 '12 at 13:53
1  
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 0.0.0.0 which I tried changing to values such as 127.0.0.1, 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 127.0.0.1 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
add comment

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 support@joyent.com 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.

Best,

--e (@ joyent)

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

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
NETWORKING=yes
HOSTNAME=funky
[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
127.0.0.1 localhost
44.33.222.111 funky

(use 'ifconfig eth0' to determine your ip)

Now ping will succeed and glassfish will start.

share|improve this answer
1  
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
add comment

Your Answer

 
discard

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.