I have a CentOS 5 server on which I plan to experiment with Glassfish. The server is up and running, I can ssh to it and have root access.

So I installed Glassfish: I followed this link on the Oracle GlassFish Downloads site and downloaded the installer file java_ee_sdk-6u4-jdk-linux-x64.sh. Then I ssh -X'ed to the server as root, ran the installer file, chose Typical Installation and left mostly every option at its default, except for the installation directory that I set to /opt/glassfish.

The installation itself worked fine, except that it failed to start the domain after successful installation. It gave me the same error message as when I now try to manually start the domain:

# /opt/glassfish/bin/asadmin start-domain
There is a process already using the admin port 4848 -- it probably is another instance of a GlassFish server.
Command start-domain failed.
# /opt/glassfish/bin/asadmin restart-domain
Server is not running, will attempt to start it...
There is a process already using the admin port 4848 -- it probably is another instance of a GlassFish server.
Command restart-domain failed.

However, there is no process running on port 4848!

# netstat -tulpn | grep 4848
# /sbin/fuser 4848/tcp
# /usr/sbin/lsof -i :4848
# grep 4848 /etc/services 
appserv-http    4848/tcp                        # App Server - Admin HTTP
appserv-http    4848/udp                        # App Server - Admin HTTP

From my own PC:

# nmap -P0 my-experimentation-server

Starting Nmap 6.40 ( http://nmap.org ) at 2014-01-13 12:37 CET
Nmap scan report for mbpc09.cs.uni-saarland.de (
Host is up (0.018s latency).
Not shown: 997 filtered ports
22/tcp   open   ssh
631/tcp  closed ipp
2222/tcp closed EtherNet/IP-1

Nmap done: 1 IP address (1 host up) scanned in 11.84 seconds

Just to be sure, I uninstalled Glassfish altogether, purging /opt/glassfish, then reinstalled it, but this time I configured the admin port to be 12345. Same result, it's telling me there is already a program running on port 12345. Except there isn't. At no point could I ever reach http://my-experimentation-server:4848, resp. http://my-experimentation-server:12345.

Any suggestions?


  1. Starting an Apache server on the my-experimentation-server on port 80 works fine, and I can reach the server from my own PC.

  2. On my-experimentation-server I issued the command nc -l 4848 which opens a TCP socket in listenting mode on port 4848. This works! From my own PC, I can then use nc my-experimentation-server 4848 to transfer messages back and forth between the two computers. So, port 4848 is not blocked by another process, or filtered by a firewall, or whatever. This is definitely a Glassfish problem.

  • If asadmin is an ASCII script file, look for the error message within it and see how it checks for other processes using the port. Servers often check for other running instances of themselves by checking the existence of a lock file (usually under /var or /var/run) so the solution can be as simple as deleting a stray file. – Joseph R. Jan 13 '14 at 12:48
  • It is a script file, though all it really does is execute exec "$JAVA" -jar "$AS_INSTALL_LIB/admin-cli.jar" "$@", so it really is Java. It is open source, so in theory could try to have a look at how this check is performed, although it would be a lot of work. But I cannot find anything that matches *glass* or *asa* anywhere in /var (using find). Also, I did successfully start a Glassfish domain on my own PC, using the same procedure. But on the virtual server I get the above error. – Malte Skoruppa Jan 13 '14 at 12:58
  • Go through this tutorial and see if you missed any steps: davidghedini.com/pg/entry/how_to_install_glassfish_3 – slm Jan 13 '14 at 13:14
  • @sim, I looked at the tutorial and it looks like I did not miss any step. That guy downloads the JDK and the Glassfish server separately, while I downloaded a bundle of the two; he just unzipped the Glassfish server code, while I used an installation program that basically does the same the thing (but enables me to configure some stuff). Just to be sure, I did it exactly his way; however, the same problem occurred. – Malte Skoruppa Jan 13 '14 at 15:40

I finally solved the problem.

The problem was that the configured hostname within the operating system did not match the actual hostname as it was known to our company's DNS server, but instead matched the hostname of some other server.

More precisely, on the CentOS server where I was trying to start Glassfish, the command hostname would output (domain name changed):

# hostname

However, mbpc05.my-domain.com is another, completely different, server within our company.

The actual hostname of my CentOS server, as known to the DNS server within our company was mbpc09.my-domain.com (i.e., 9, not 5!).

So, I issued the following command (as root) on my CentOS server to change the hostname:

# hostname mbpc09.my-domain.com

That fixed it. Afterwards, I could start the Glassfish server without any problems.

I assume that what happened is that the Glassfish server retrieved the local hostname from the operating system, then tried to start a server on that host - but since that hostname belonged to an entirely different server, it would try to start a Glassfish server instance on a remote server, or something like that. This of course failed. The error message output by Glassfish was very confusing and had nothing to do with the actual problem (I expect some exception was thrown in the Java code which then output that message - the error handling could be more accurate), which is why it took me some time to solve it. :)

|improve this answer|||||
  • 1
    Thanks a lot, helped me, i also changed /etc/hosts to the previous hostname – BOUKANDOURA Mhamed Jun 6 '17 at 8:28

Thank you very much. It takes lots of time to understand whats going on. I tried to setup local environment on my local mac pc but getting same error.

**I changed as follows ... **

// Step1: Checked the current hostname

$ hostname


// Step 2: Change the hostname as localhost

$ hostname localhost

// Step 3: Check the changes

$ hostname


// Step 4: Now I started my glass fish server

$ asadmin start-domain domain1 Admin Port: 4848 Command start-domain executed successfully.

... Worked perfectly ....

|improve this answer|||||

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.