Last month, we discussed application servers, and in particular, the glassfish app server. This month we will look at how to get started with glassfish version 2 on Debian GNU /Linux. For other distributions, the procedure will be almost the same.

Installation of GlassFish

GlassFish v2 requires JDK 1.5 or a later version. So if you are using Fedora 9 or Ubuntu 8.4, you already have OpenJDK 6. You can check the version ofJava with the Java -version command at a terminal prompt. This command will print the available version ofJava on your system. For example, on my system the available version of]ava is 1.4.2 as can be seen from the following terminal output:

So I have to installJDK 1.5 or later before installing and configuring GlassFish. Verify that your /etc/apt/sources.listflle has the following entries and you are connected to the Internet:

Than simply run the followi=ning command:

it will install JDK 1.5 or above on your system. now that we have successfully completed the basic requirements, download the GlassFish jar file from downloadjava.netljavaee5lv2ur21 promotedILinuxlglasifish-installer-v2ur2-b04-linux.jar and issue the following command:

This command will show a licence agreement window-it's dual licensed under CDDL and GPL. After accepting the licence it will create a directory namedglassfish in your current working directory. After the installation is complete, we need to set it up before being able to use it.

Name:  Glassfish.jpg
Views: 345
Size:  80.7 KB

To set up GlassFish navigate to the glasifish directory from the terminal. Here you will see a file named setup.xml. This file is the input file for ant builder scripts that will configure GlassFish. setup.xml contains the following configuration property elements:

Before setting up the server, you need to make some changes in the property values according to your preferences. First of all, change the default adminpassword property, which by default is set as 'adminadmin' (see line 5 in the above snippet). You need to remember this password, as it will be used for login and deploying applications later. You can also change the ports on which the 'admin and applications will listen. Change them accordingly if they conflict with services that listen on the same ports.

After making changes in ie configuration file, it's time to start the build process. I will nkommend a set-up process such that in the future you can easily update GlassFish with its new releases.

We will move glassfish to loptlglasifish-v2, and then create a soft-link (In -s loptlglassfish-v2 loptlglasifish) such that in the future we can easily upgrade it. Make the ant builder script executable by issuing the following command:

Now, to start the build process, issue the following command:

You should soon get a 'build successful" message as shown in Figure 1. To start the server and check whether it is installed and configured successfully, issue the following command:

and point your browser to. You should get a login page as shown in Figure 2. If you don't, then recheck the whole procedure for the possible error. For login, use the password you have applied for the admin. password property earlier.