Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

I'm trying to start glassfish on an EBS-based AMI of Ubuntu 10.04 64-bit. I have used glassfish on non-ec2 servers with no problems, but on ec2 I get this message:

$ sudo -u glassfish bin/asadmin start-domain domain1
There is a process already using the admin port 4848 -- it probably is another instance of a GlassFish server.
Command start-domain failed.

I know that ec2 has requires that firewall rules be modified using ec2-authorize to let outside traffic thru the firewall, as I had to do to make ssh work. This still doesn't explain the port error when all I'm trying to do is start glassfish so I can try

$ wget localhost:8080
and make sure it's working.

This is very frustrating and I'd really appreciate any help.


Sorry if you came here looking for answers. I never figured out what was causing the problem. I created another fresh instance, installed the same stuff, and Glassfish worked perfectly. Something obviously got boned during installation, but I have no idea what. I guess it will remain a mystery.

UPDATE: Here's what I get from netstat:

# netstat -nuptl
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name
tcp        0      0    *               LISTEN      462/sshd        
tcp6       0      0 :::22                   :::*                    LISTEN      462/sshd        
udp        0      0  *                           483/avahi-daemon: r
udp        0      0  *                           589/openvpn     
udp        0      0 *                           483/avahi-daemon: r
udp        0      0    *                           377/dhclient3   

UPDATE: One more thing... I know that the "net.ipv6.bindv6only" kernel option can cause problems with java networking, so I did set this:

# sysctl -w net.ipv6.bindv6only=0

UPDATE: I also verified that it has nothing at all to do with the port number (4848). As you can see here, when I changed the admin-listener port in domain.xml to 4949, I get a similar message:

# sudo -u glassfish bin/asadmin start-domain domain1
There is a process already using the admin port 4949 -- it probably is another instance of a GlassFish server.
Command start-domain failed.

Here are the contents of /etc/hosts: localhost

# The following lines are desirable for IPv6 capable hosts
::1 ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
ff02::3 ip6-allhosts

I should mention that I have another Ubuntu Lucid 10.04 64-bit slice that is NOT hosted on ec2, and set it up the exact same way with no problems whatsoever.

Also server.log doesn't offer much insight either:

# cat ./server.log 
Nov 20, 2010 8:46:49 AM com.sun.enterprise.admin.launcher.GFLauncherLogger info
INFO: JVM invocation command line:
share|improve this question

5 Answers 5

up vote 0 down vote accepted

You're right - firewalling has nothing to do with the open (presumed TCP?) port.

netstat is your friend. Something similar to netstat -nupt -l will give you an indication of what processes are listening on what ports.

Let us know the output of that command, and whether it helps point you in the right direction.

share|improve this answer
Thanks. As you can see from netstat the port doesn't seem to be in use. :( –  orange80 Nov 20 '10 at 8:05
Your issue seems related to this: serverfault.com/questions/90493/used-blocked-ports-in-ubuntu - where one of the answers mentions looking at the /etc/hosts file for the culprit, based on the logs. So first check/share your app logs, second check /etc/hosts for anything missing/additional. –  Zayne S Halsall Nov 20 '10 at 8:25
I updated above. I don't see anything to indicate that /etc/hosts is the problem at all. I was able to fire up # python -m SimpleHTTPServer and read from localhost using # wget localhost:8000 with no problems as well. –  orange80 Nov 20 '10 at 8:51
Based on some googling, I'd recommend you try adding whatever host name is returned from hostname, and the IP returned when doing a dig or host against that name, into your /etc/hosts file - just as a quick test. What I don't like about the info provided thus far, is the application is clearly complaining, yet there is nothing in the logs echoing even that same issue. Are you looking at the correct logs (I know how... complex Java apps can be :) )? –  Zayne S Halsall Nov 20 '10 at 9:10
I'm not sure where else to look honestly. I think it's weird too, but that is the full log from one invocation of asadmin start-domain. It's the only log in glassfish/domains/domain1. As a test I did put the hostname and value returned by host $hostname, but still this had no effect, even after a restart. –  orange80 Nov 20 '10 at 17:25

I don't know why your hosts file was brought up, as these have nothing to do with each other.

This sounds to me (based on your revisions) that its not that something is currently listening on the port--but that you may have configured TWO things to listen on the same port in the same Glassfish instance. So if you start Glassfish and it tries to launch listeners on each of the ports, it will fail, and consequently shutdown the previously started services. So when you use netstat before and after, it reports correctly that nothing is currently listening on the ports.

Check that each of your listeners is on a different port using asadmin, and I'll bet you find that the port number is used twice. Or it could simply be that the initialization is causing two instances to start up simultaneously, which would give you the same behavior. Can you try configuring a brand new domain on different ports to see if you experience a similar issue?

Best of luck!

UPDATE: Try using the following to get all the listeners:

asadmin get server | grep -i listener
share|improve this answer
Unfortunately the server refuses to start, I get this: # bin/asadmin get server | grep -i listener Remote server does not listen for requests on [localhost:4848]. Is the server up? –  orange80 Nov 21 '10 at 5:42
Try asadmin get server.*. What you're seeing is probably stderr, not stdout--pipes will not pipe stderr unless instructed to do so. If you are still not getting anything, then it sounds like there are no configured listeners... which indicates even more issues with your install. –  Andrew M. Nov 21 '10 at 15:46

same problem here. It is related to /etc/hosts i did a cat /etc/hostname and added this for

share|improve this answer

This error is thrown not only when the port is taken, but also erroneously when there is an error with the /etc/hosts file.

Make sure you have proper definitions for your hostname (have you changed it recently?) in the file, and that it is not missing. For example, if you just changed your hostname (either via hostname or in /etc/hostname) to server.example.com, then make sure that your /etc/hosts file has: server.example.com localhost
share|improve this answer

Recently, I found that launching a server into VPC requires quite a bit of extra configuration (once off) to get started. A key clue:

 nslookup `hostname`

should work. If it doesn't work, that's likely to be the reason.

You can either: 1) launch a server into EC2-classic 2) configure your VPC / host to be able to run the command above successfully.

Hope that helps.

share|improve this answer

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.