How to Restart Glassfish Application Server in Linux using a Command in the Command Line Interface

Posted on

Introduction

This article focus on how to restart the service of the Glassfish Application Server. In general, the process for restarting the Glassfish Application Server’s service is using a certain command. The execution of the command itself is done in the command line interface. In order to restart the process, there are several steps to achieve it. The following are those steps to perform the restart process :

Connecting to the Glassfish Application Server

1. Before proceeding to the action for restarting the Glassfish Application Server, just make sure that the Glassfish Application Server process is actually running. Read the article with the title of ‘How to Check Glassfish Application Server Process in Linux using a Command in the Command Line Interface’ in this link to retrieve an additional reference to check the process.

2. After checking the process and it turns out that the running process of the Glassfish Application Server exist, perform the connection. In this context, it is performing the connection to the Glassfish Administration Console. Since the method for restarting the Glassfish Application Server is by performing a certain command it the command line, run the command line interface. In the command line interface, switch to the associated user account to manage the process of the Glassfish Application Server as follows :

user@hostname:~$ sudo su - glassfish
[sudo] password for user:  
$ 

After switching to the ‘glassfish’ account, perform the following command to connect to the Glassfish Application Server :

$ /opt/glassfish4/glassfish/bin/asadmin
Use "exit" to exit and "help" for online help.
asadmin>

The above command is just execute the file executable script for accessing the Glassfish Administration Console. In this article context, the location of the Glassfish Application Server happens to exist in the ‘/opt’ folder. So, the full path to execute the executable script of Glassfish Application Server is ‘/opt/glassfish4/glassfish/bin/asadmin’.

 

Restarting the Glassfish Application Server

After successfully execute the command line interface and connect to the Glassfish Administration Console, just restart the process. The following is the command to restart the process of the Glassfish Application Server :

restart-domain

So, the execution of the above command in the Glassfish Administration Console will appear as follows :

asadmin> restart-domain
Successfully restarted the domain
Command restart-domain executed successfully.
asadmin>

Last but not least, the above step is available for an execution in only just one line of command. That command execution exists as follows :

$ /opt/glassfish4/glassfish/bin/asadmin restart-domain
Successfully restarted the domain
Command restart-domain executed successfully.
$ 

As in the above command output appears, the restart process is a success. Either it is a several steps to achieve the process or it is in only one line of command execution. Restarting the Glassfish Application Server is finished.

Leave a Reply