May 25, 2017

How to backup and restore domain in Glassfish / Payara Java EE application Server

1.  Execute asadmin utility of your Glassfish distribution.
2.  Stop your domain if it’s running by issuing stop-domain <YOUR DOMAIN NAME> command.
3.  Run backup-domain <YOUR DOMAIN NAME>.
4.  After executing the backup domain command, your backed up domain is located under glassfish_ home/domains/<YOUR DOMAIN NAME>/backups  directory a .zip file.
5.  Copy the generated .zip backup file to other location.
6.  Now delete your existing domain by issuing delete-domain <YOUR DOMAIN NAME> command. (optional, since we are going to restore it by force later)
7.  Open your backup file, normally packaged as a zip file. Open the file and change property to your desired name.
8.  Save the file and make sure that the modification is applied to your zip file too.
9.  Bring up asadmin utility up and issue the following command
restore-domain --filename <PATH TO BACKUP ZIP FILE> --force
10.  Execute list-domains command to see your domain with its new name.