Used/blocked ports in Ubuntu

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 127.0.1.1 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. 127.0.1.1 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)