I have .war file and an access to remote glassfish server. I want to deploy the .war file on the server.
2 Answers
Try below steps:
- From your Terminal, scp your .war file to a temporary folder on the remote server: From your current directory(where you have your .war file) Ex. scp ~/workdir/mySampleApp.war userID@host:/tmp
OPen Another Terminal and login to your remote server[Given you have access to the server]: ssh @host-id
Go to Glassfish folder:
cd /opt/glassfish4/glassfish/
Run the deploy command:
bin/asadmin --user admin --passwordfile /opt/glassfish4/glassfish/domains/domain1/config/domain-passwords deploy /tmp/mySampleApp.war
This will deploy your .war from the '/tmp' folder to the glassfish server.
You can run your app on the browser on remote server after success deployment.

- 151
- 1
- 1
- 7
Since you didn't mention the server you are using, I will assume you are on an Ubuntu machine and the remote server is also Ubuntu.
You will use SFTP to copy the application.war to the server. on your terminal type and press enter
sftp yourusername@remoteserver.com
- enter your password
output will be of the form
connected to remoteserver.com
sftp>
Then type the command
sftp>put 'path/to/your/application.war'
and press enter, you may also choose to drag and drop the war file on the terminal.
Wait for the file to finish uploading.
Then now you need to ssh into the remote server using another terminal with the command
ssh yourusername@remoteserver.com
press enter
and key in your password when prompted.
Once connected you then change into the glassfish install directory bin
folder and then enter the command.
./asadmin deploy 'path/to/application.war'
and press enter.
The application uploaded using the command put
in the sftp session above will be found in your home folder so you might type
./asadmin deploy ~/application.war
and enter your glassfish admin password.

- 1,291
- 2
- 17
- 34