Glassfish in the trenches: Domains cheatsheet
Often the new Glassfish adopters aren’t really familiar with the concept of domain, which is really handy when developing Java EE applications.
First of all, what’s a domain? A complete (and complex) definition can be found here. Simply put, a domain is a Java EE engine which can be administered, configured, started and stopped separately from other domains.
The simplest tool to work with domains is asadmin, a command-line tool located in the bin directory of your Glassfish installation; specifing the right parameters, you can do every administrative task using asadmin. Let’s procede with our cheatsheet.
|
Task |
Command |
|
Start a domain |
asadmin start-domain <domain-name> |
|
Stop a domain |
asadmin stop-domain <domain-name> |
|
Backup a domain [1] |
asadmin backup-domain <domain-name> [2] |
|
Restore a domain from its backup |
asadmin restore-domain <domain-name> [3] |
|
Create a new domain |
asadmin create-domain –adminuser admin –adminport 4848 <domain-name> [4] |
|
Delete a domain |
asadmin delete-domain <domain-name> |
Notes
- [1] This is actually one of the must useful but overlooked functionalities. Always create backups of your domains!
- [2] If not specified (using optional parameters) the backup is created under the domains/<domain-name>/backups folder
- [3] Glassfish determines which is the most up-to-date backup of the specified domain
- [4] The adminuser parameter specifies the administrator username; adminport specifies the port for the administrative console (in this case it will be reachable at http://localhost:4848)

1 Comment