Over a million developers have joined DZone.

Renaming Glassfish Application Server's Domain Name

· Java Zone

Microservices! They are everywhere, or at least, the term is. When should you use a microservice architecture? What factors should be considered when making that decision? Do the benefits outweigh the costs? Why is everyone so excited about them, anyway?  Brought to you in partnership with IBM.

Renaming domain names is not supported by Glassfish application server. There is no toolkit or any command available by Glassfish to perform domain name rename. You can choose your desired domain name when you install glassfish 3.x, but Glassfish 4 doesn’t let you choose your desired domain name (auto selecting domain1 for domain name). Without diving into domain configuration files or messing with domain XML files, the rename operation can be done quickly and cleanly. In case another name is required for currently operating Glassfish domain, follow these simple steps:

Steps are so easy and simple:

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. Don’t worry you have already backed up your domain settings, remember?

7.  Open your backup file, normally packaged as a zip file. Open the backup.properties file and change the domain.name 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  domain1 --filename <PATH TO BACKUP ZIP FILE> --force

10.  Execute list-domains command to see your domain with its new name.

That's it. Your domain name is changed and your settings are restored as well.

Discover how the Watson team is further developing SDKs in Java, Node.js, Python, iOS, and Android to access these services and make programming easy. Brought to you in partnership with IBM.

Topics:

Opinions expressed by DZone contributors are their own.

The best of DZone straight to your inbox.

SEE AN EXAMPLE
Please provide a valid email address.

Thanks for subscribing!

Awesome! Check your inbox to verify your email so you can start receiving the latest in tech news and resources.
Subscribe

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}