Monday 7 January 2013

Glassfish Commands

Here are some useful glassfish commands

File structure

Glassfish has a weird file structure.  One installation everything is in


but the actual default domain location is in


Other domains can be created in different locations to this and glassfish will only start the domain specified rather than starting all domains in a domain location.  This is glassfish's way of keeping separation between installations.  You can, of course, install multiple applications into a single domain.

In the commands below either the asadmin needs to be on the path or prefix the asadmin with <glassfish_home>/bin/.

Starting a Domain

To start a domain in the default location just do

    asadmin start-domain <domain_name>

if there is only one domain then the domain_name can be dropped.

Often it is useful to have domains installed in different locations.  To do this use

    asadmin start-domain --domaindir <domain_location> <domain_name>

Again if there is only one domain in the domain_location then the name can be dropped.

Stopping a Domain
The simple command to stop a running domain is

    asadmin stop-domain <domain_name>

If you are running a cluster you may need to do this bit first before stopping the individual domains.

    asadmin stop-cluster <cluster_name>

Creating a Domain

To create a new domain use the command

   asadmin --user admin --port 4848 --host localhost --interactive=true create-domain --domaindir <domain_location> --adminport 4848 --instanceport 8080  <domain_name>

Where domain_location and domain_name need to be completed.

Deleting a Domain

To delete a domain use

    asadmin delete-domain --domaindir <domain_location> <domain_name>

No comments:

Post a Comment