Monday, 15 August 2011

Creating multiple domains in Glassfish 2.1

Suppose we have already installed glassfish and the default domain domain1 is created. Now we want to create additional domains.
To understand  the concept of Glassfish domain. Please go through it.

In this example I am going to use the asadmin create-domain command. I am using windows XP machine and Glassfish Enterprise Server v2.1.1
My Glassfish is installed in F:\Glassfish folder.
I am going to create new domain as domain3.
Go to the asadmin command prompt.
The command for creating domain is create-domain. This command has many options and I am going to use few of them here.

The options I used:
1) user : The name of the user who will be the administrator for this new domain.
2) adminport: This is the port on which the domain admin console runs.
3) instanceport: It specifies the port where the web applications (deployed in the new domain) context roots are available.
4) passwordfile: The password file contains the new domain’s admin password. The create-domain command reads values for AS_ADMIN_PASSWORD and AS_ADMIN_MASTERPASSWORD from this file. The content of the file is AS_ADMIN_PASSWORD=password. If AS_ADMIN_PASSWORD or AS_ADMIN_MASTERPASSWORD is not in the password file, the create-domain command prompts for admin password and master password.
5) savelogin: If we set this option true, create-domain saves the admin user name and password in the .asadminpass file in user’s home directory (in my case in C:\Documents and Settings\pranabs.MKCLVASHI folder).
I have some other domains running in the system, so the default ports for JMS, IIOP, HTTP_SSL, IIOP_SSL, IIOP_MUTUALAUTH, JMX_ADMIN already occupied, no problem with that, it will automatically take the available ports. Or we can set the ports at the create-domain command option also.
Above command will create the new domain in the default domain directory (i.e. in my case in the folder F:\Glassfish\domains folder). Suppose we want to place the domain in some other location, then we can specify the domaindir option of the create-domain command to the desired location.

Start the domain3 and our domain3 is ready is for work.

জয় আই অসম,
প্রণব শর্মা