starting up Glassfish AS would tell me the port 4848 is blocked (or any port that I configure). But checking the ports are not used. There is no firewall.

root@ubuntu:~/glassfishv3/glassfish/bin# netstat -tlunp
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name
tcp        0      0    *               LISTEN      2149/sshd       
tcp        0      0 *               LISTEN      2441/cupsd      
tcp        0      0  *               LISTEN      2075/postgres   
tcp6       0      0 :::22                   :::*                    LISTEN      2149/sshd       
tcp6       0      0 :::5432                 :::*                    LISTEN      2075/postgres   
udp        0      0    *                           2082/dhclient3  
udp        0      0 *                           2413/avahi-daemon: 
udp        0      0  *                           2413/avahi-daemon: 

Ubuntu 9.04 Linux ubuntu 2.6.28-11-generic #42-Ubuntu SMP Fri Apr 17 01:58:03 UTC 2009 x86_64 GNU/Linux (its a virtual server hough).

Not quite sure how to approach this problem.

  • 1
    What is the actual error message from Glassfish?
    – Insyte
    Dec 3 '09 at 5:12
  • 1
    root@ubuntu:~/glassfishv3/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.
    – javadude
    Dec 4 '09 at 0:52
  • ive just have this problem on ec2, the answer by Gvenez was the answer, a simple hostname command solved the problem. sudo hostname localhost
    – user90004
    Aug 1 '11 at 5:29

Missing etc/hosts file !

java.net.UnknownHostException: ubuntu: ubuntu
    at java.net.InetAddress.getLocalHost(InetAddress.java:1353)
    at com.sun.enterprise.util.net.NetUtils.getCanonicalHostName

Simple reason, sometimes should not search for complex problems !


add your-computer-name to your /etc/hosts

and try again!

best regards.


Once I got a similar exception, and I post the solution here just in case someone digging around needs it: There is a process already using the admin port 4848 -- it probably is another instance of a GlassFish server.

java.net.BindException: Invalid arguments: bind: 7676=com.sun.enterprise.v3.services.impl.ServiceInitializerHandler

The, you'd have to change the key "net.ipv6.bindv6only" from "1" to "0" in "/etc/sysctl.d/bindv6only.conf", which is a kernel parameter that enabled enables IPV6 applications to listen only IPV6 "request" (request is not the expression, but you get the point)


I had this problem and the culprit was in /etc/hosts, there were two entries and the "hostname" command returned a reference to the second entry. When the second entry was made the first entry, e.g. my.domainname.com (or localhost) then that fixed the problem.


For me the problem turned out to be the 'hostname' due to multiple interface.

Run 'hostname' and then see if you can ping the results

Run java -jar glassfish3/glassfish/modules/glassfish.jar and check for the verbose logs

Set hostname to "localhost" by hostname localhost

The bottom line is that your server has trouble binding to the hostname (not the port like it says in the error message)


Another reason that I just encountered were that the hostname and ip address just didn't match:

hostname -i

The IP number returned by hostname -i is different to the one assigned to the server. My guess is that this causes Glassfish to try to bind the port on the old ip address returned by hostname -i, which is obviously going to fail.

The problem was caused by the machine being moved to another network segment after installation.


As Insyte suggests, the exact error might help us troubleshoot.

But in the case of nothing helpful from glassfish, you might consider strace(1), so that you can find the system call that fails and the error it throws. You might need -f to follow forked child processes, depending on how glassfish behaves.


Is it possible that it's telling you that the port is blocked on the firewall? If that's the case, you'll have to configure a rule to allow the incoming connections.

  • root@ubuntu:~# ufw version ufw 0.27-0ubuntu2 Copyright (C) 2008-2009 Canonical Ltd. root@ubuntu:~# ufw status Status: inactive root@ubuntu:~#
    – javadude
    Dec 4 '09 at 0:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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