Linux: GlassFish installation

by Sankar H,

Guru

GlassFish is an open-source, freely available, Java EE (called J2EE formerly) application server. Like all Java EE-compliant application servers, GlassFish provides the necessary libraries to develop and deploy Java applications compliant with Java EE specifications. Java EE technologies include Servlets, JavaServer Pages (JSPs), JavaServer Faces (JSF), Enterprise JavaBeans (EJBs), and the Java Messaging Service (JMS).


To install and configure GlassFish you need to have a working JDK installation. Enterprise Server v3 requires JDK release 6. The minimum (and certified) version of the JDK software that is required for Enterprise Server on *nix platform is 1.6.0_17. (in case you have an older version, you might need to update it). The command java -version should give you the version information of the installed JDK.

# java -version
java version "1.6.0_16"
Java(TM) SE Runtime Environment (build 1.6.0_16-b01)
Java HotSpot(TM) Client VM (build 14.2-b01, mixed mode, sharing)

* Note : In the case above, an update is needed(version shown is 1.6.0_16).

GlassFish Installation :

The process involves getting the Full Platform Profile distribution, from the GlassFish Community site. Look for glassfish-v3.zip from http://download.java.net/glassfish/v3/release/

Fetch it to the desired location in your server(say /opt). Unzip it, and the Enterprise Server v3 is installed into a new glassfishv3 directory under your current directory.

Supposing you have installed it to /tmp, the startup script would be in /tmp/glassfishv3/bin/

Change directory to the path and execute the script(asadmin) with the command below:


# ./asadmin start-domain
Waiting for DAS to start ..............
Started domain: domain1
Domain location: /tmp/glassfishv3/glassfish/domains/domain1
Log file: /tmp/glassfishv3/glassfish/domains/domain1/logs/server.log
Admin port for the domain: 4848
Command start-domain executed successfully.


Here, /tmp was the folder used for installation, just for the sake of demonstration. Normally you would prefer installing the application server to /usr/local or /opt.

To determine whether a domain is running, use the asadmin list-domains command, and to stop use asadmin stop-domain :


# ./asadmin list-domains
Name: domain1 Status: Running
Command list-domains executed successfully.


Your server would be now running on port 8080, and the Administration console on port 4848. In case the installation is your local machine, you could access it at http://localhost:8080 and http://localhost:4848 in case it is on a server, you could access them at http://server_IP_Address:8080 and http://server_IP_Address:4848 (replace server_IP_Address with the server's IP address).


# netstat -plan|grep 4848
tcp6 0 0 :::4848 :::* LISTEN 7194/java
# netstat -plan|grep 8080
tcp6 0 0 :::8080 :::* LISTEN 7194/java


The first thing to do after you login to admin console is to change the password! To do that, click " Enterprise Server " on the left side pane, and go to " Administrator Password ", type in the new password and save it. You should then see the following message " New values successfully saved. "

As you would have gathered, the installation is quick and easy! The following page has various guides that would prove useful for getting started :
http://docs.sun.com/app/docs/coll/1343.9


About the Author :

Sankar works as a Senior Software Engineer in Bobcares. He joined Bobcares back in April 2006. He loves grooming/mentoring people. During his free time, he listens to music, and enjoys singing..