I'm writing a bash script that pulls a specific copy of our java web application from the svn repository and builds it.

I would like that script to be able to deploy the generated .war file on the glassfish server.

The script and glassfish server are on the same machine. The script has access to the glassfish folder containing the "asadmin" utility.

The problem: asadmin asks for a password (I can specify the user name with a "--user" parameter). I'm not sure if it's possible to specify the password through a "--password" parameter, but for obvious reasons, that's not an option on a production server.

Is there some way to automate this deployment process anyway? Setting an empty password for the admin might be an option, but I can only accept it if it is possible to disable the "admin" user in the control panel (accessible by multiple users).

I also thought of simply copying the generated classes to the glassfish/domains/ourdomain/applications/ourapplication/ folder. However, I doubt this is the correct way to perform a deployment. Moreover, the application does not get reloaded that way, and users are still seeing an old version of the application!


Thank you for the suggestions!

  • Why is it not an option to use a --password parameter? – ℝaphink Jun 20 '12 at 22:52
  • Thanks for your comment. Using --password would mean I have to store the password nonencrypted in the script. Even if non-admins are not supposed to be able to see the script, we want that extra layer of security by not exposing a glassfish admin password. Storing plain-text passwords is commonly avoided after all, not just on application servers. – Eti Jun 20 '12 at 23:21
  • If you used a configuration management system (such as Puppet for example), you would store the password on your configuration server instead of storing it in a local script... – ℝaphink Jun 21 '12 at 13:19
  • Thanks for the info. That would still store it unencrypted or in a way that it can easily be decrypted, which is exactly what we want to avoid. I finally found a way to do what I needed without storing the password in any way, which is preferable. – Eti Jun 24 '12 at 21:55

While crawling blogs trying to find out how to store the passwords in a keystore and load them automatically, I eventually discovered the use of the glassfish/domains/ourdomain/autodeploy/ directory:

Turns out you can simply copy the .war file to that folder, and it'll be picked up and deployed automatically by glassfish on the first request!

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.