0

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?

1
  • 1
    GlassFish reports any bind failure with this message. You should treat it as just "bind to port XXXXX failed for some reason". Feb 29, 2012 at 11:48

6 Answers 6

1

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.

6
  • Does 127.0.0.1 work on the machine? Can you ping it? Feb 29, 2012 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, 2012 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, 2012 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
    Feb 29, 2012 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
    Feb 29, 2012 at 18:35
1

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.

4
  • 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. Nov 19, 2012 at 12:30
  • As the questioner pointed out: 'every port is taken'.
    – bebbo
    Nov 19, 2012 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, 2012 at 22:33
  • Not quite the solution we needed, but "This symptom occurs if your chosen host name does not resolve." was very useful to me, The error saying something completely different is what threw me off
    – Jasper
    Nov 15, 2023 at 14:39
0

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?

1
  • 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
    Feb 29, 2012 at 11:43
0

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 [email protected] 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)

1
  • You work at joyent?
    – Steve
    Mar 2, 2012 at 7:33
0

I have found on a Centos 6 Oracle Xe installation I have to check the following /etc/sysconfig/network:

/etc/hosts
$HOSTNAME

In my case, it was /etc/sysconfig/network host definition conflict that caused the problem. thanks to bebbo

Oracle specific host areas

listener.ora (not always essential but can pertain) tnsnames.ora in SQL+ show parameter local_listener glassfish check the config in defaults.xml

0

I had same issue as above after changing my vm hostname to mydomain.xx.xx from localdomain.localdomain. After reading the comments and answers above, I fixed this issue by adding the new host name in my >/etc/hosts as below

127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4 mydomain.xx.xx

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .