Sunday, February 5, 2012

WAS command line to install an .ear

This is a one liner that I just got to work which installs an .ear containing a single .war into my local copy of WAS8. It's only one example of how one could use the wsadmin command line tool to perform automated installations in WAS. Obviously different types of apps and configurations will require different command lines but this should get an interested person headed down the right road:

~/development/tools/IBM/WebSphere/AppServer/bin/wsadmin.sh -username admin -password admin -c '$AdminApp uninstall MavenTutEAR' -c '$AdminApp install MavenTutEAR-1.0.ear { -defaultbinding.virtual.host default_host -usedefaultbindings}' -c '$AdminConfig save' -c 'set appManager [$AdminControl queryNames type=ApplicationManager,*]' -c '$AdminControl invoke $appManager startApplication MavenTutEAR'

Note that this is hardly the only, or the best way to do something like this. It is just A way to achieve what I was trying to do. Another option I was about to explore is trying out the auto deploy directory setup (Applications > Global deployment settings).

If your actually curious why I'm doing this (much less posting about it) I have been trying to conquer my fear/ignorance of using maven with WebSphere, EAR's and possibly some EJBs... naa fuck that for now... by building a collection of maven projects that spit out an EAR that I can deploy into WAS. This monster command line is the finishing touch on that adventure.

It's certainly not good for anything beyond local development, perhaps, but that's all I need right now. If I'm lucky, and the planets align, this same EAR project could be deployed into WebLogic or JBoss too with out much extra fuss.

Anywho, many thanks to whomever put this page together:
http://code.google.com/p/codesnippetssite/wiki/BasicWebSphereAdminwsadmin, it was a big help!

No comments:

Post a Comment