Installing Glassfish 3.1 on headless Centos 5.5

i run into some problems installing glassfish on a centos server without X-Windows. You can use the glassfish installer, but actually just unzipping the glassfish-zip is the easier method.

Method 1: Installing just with a zip file (easy method)

1. you have to get a java sdk and install (i used the rpm provided by oracle)
2. get the glassfish zip-file install package

3. to install the glassfish server, just unzip it in the directory you want. For example for /opt

cd /opt
wget http://download.java.net/glassfish/3.1.2/release/glassfish-3.1.2-ml.zip
unzip glassfish-3.1.2-ml.zip

4. configure the jdk in file /opt/glassfish3/glassfish/config/asenv.conf, add the line AS_JAVA=[pathtoyourjdk]

AS_JAVA=/opt/jdk1.6.29

5. check your /etc/hosts file. There HAS TO BE a entry with your hostname pointing to eth0
(eg. if eth0=192.168.123.3, then you need a line like this
192.168.123.3 centsrv.example.com centsrv

otherwise you will get the error “There is a process already using the admin port 4848 – it probably is another instance of a GlassFish server.”

Method 2: Installing with the Glassfish Installer

loli (local linux box) you need X-Windows running there of course
centsrv (remote centos server without X11)

1. you have to get a java sdk and install (i used the rpm provided by oracle)
2. get the glassfish install package for linux
3. install the xauth package (e.g. yum install xorg-x11-xauth) without it you can’t with ssh X-forwarding
4. connect with X forwarding to centsrv: ssh -X root@centsrv
5. now simply start the glassfish setup, the graphical installer will start on your local linux machine (loli) but it will run on the server centsrv. i installed glassfish under /opt/glassfish3
6. check your /etc/hosts file. There HAS TO BE a entry with your hostname pointing to eth0
(eg. if eth0=192.168.123.3, then you need a line like this
192.168.123.3 centsrv.example.com centsrv

otherwise you will get the error “There is a process already using the admin port 4848 – it probably is another instance of a GlassFish server.”

First steps

Start the glassfish-server

/opt/glassfish3/glassfish/bin/asadmin start-domain

Now go to the admin console http://[yourdomain].com:4848/

to upload the first webapplication

The logfiles for the default domain domain1 are located in /opt/glassfish3/glassfish/domains/domain1/log/

3 comments

Archived from the original WordPress blog. Comments are closed.

  1. pascal

    The same problem has also generated me.
    I use scientific linux 6.1

    Did you solve?

  2. admin
    check point 6. of the tutorial, this is crucial for getting glassfish to work
  3. Xavier Calle

    If you have the “host name not found” on glassfish installation. Make the following:

    1) In a console, press hostname command to view your current hostname.
    2) Add your host tame to the /etc/hosts file
    127.0.0.1 yourhostname
    3) Try again (it is not necessary restart)