Introduction

In the previous blog posts we have described how to install the Oracle Java 7 Runtime and how to install the Glassfish 4.0 server on Ubuntu Server 12.04 LTS.

In many cases the server is not the localhost but a production server, so we have to deploy our application by remote. Therefore we need to enable the remote admin access. This is disabled for security reasons since Glassfish 3.

The first step is to setup the admin password. By default the password is empty. The password can be set by the use of the asadmin. In the previous blogpost we have installed Glassfish on the server in the path “/opt/glassfish4/”. So we have to go to this directory:

cd /opt/glassfish4/bin

Now start the asadmin by:

sh asadmin

or by

./asadmin

You will land in the prompt of the asadmin console. To change the password type the following:

change-admin-password

The prompt will be looking something like this:

asadmin> change-admin-password
Enter admin user name [default: admin]>     
Enter the admin password>
Enter the new admin password>
Enter the new admin password again>
Command change-admin-password executed successfully.

If you haven’t set any password before or haven’t changed the admins username you can just push the “Enter”-button on the first two questions. After that you will have to type you own new password.

Setting the admin password for different domains

If you would like to set the admin password for some specific domain, you would use the following command:

asadmin change-admin-password --domain_name [DOMAIN_NAME]