Wednesday, June 13, 2012

How to restart-domain in GlassFish?

Restarting an appserver is a common operation after manually editing server config, or adding new library jars, or just to be safe. I hava an alias to restart GlassFish, and all it does is: stop domain, sleep 3 seconds, and start domain.

In GlassFish v3, this can be done with a single asadmin command: restart-domain.

First, I tried restart-domain while the server is not running, which is equivalent to start-domain command:
./asadmin restart-domain
Server is not running, will attempt to start it...
Waiting for DAS to start .....................
Started domain: domain1
Domain location: /v3/glassfish/domains/domain1
Log file: /v3/glassfish/domains/domain1/logs/server.log
Admin port for the domain: 4848
Command restart-domain executed successfully.

Then, try it while the server is running. This command takes a few seconds to finish since it involves stopping the domain first, possibly pausing a bit, and then starting the domain:
./asadmin restart-domain
Successfully restarted the domain
Command restart-domain executed successfully.

No comments:

Post a Comment