views:

1452

answers:

3

I am trying to remotely deploy a war file to a websphere application server. I understand this is possible to do using wsadmin, but I am a Websphere newb.

I know I can run wsadmin and connect using SOAP to the remote app server, but that is where I am at.

This seems like it should be a common use case, can anyone help me with?

I suppose the use case follows: 1. Update the application 2. Save all changes 3. Restart the remote application server

I am going to do the deployment using either Hudson WAS Builder or Maven, whichever works.

Thanks for your help

+1  A: 

Since the WAS Builder Plugin is relatively new, I haven't tested it (The evaluation is already on the ToDo list). For running deployments from the command line we use jython-scripts and wsadmin. My understanding is that I need to be on the machine where I want to deploy. You can deploy to a different machine id your local wsadmin is on the level than your target machine (same version and same feature packs).

for more information on wsadmin see http://publib.boulder.ibm.com/infocenter/wsdoc400/v6r0/index.jsp?topic=/com.ibm.websphere.iseries.doc/info/ae/ae/rxml_commandline.html

BTW, when you deploy using the web based admin console, there is a link somewhere at the end of the deployment process that shows you the jython command. Don't use jacl, since WAS 7 only uses jython.

Peter Schuetze
Thanks for the response. I see that I have to create a script, so I am brand new here. I want to 1)update the app 2)AdminConfig.save 4) wait until app is ready 4)shutdown server and 5)start server in the script. The only thing I don't know how to do is script 4) above - wait until app isReady returns true
noplay
When the AdminConfig.save() returns the server is ready to be restarted. You can only restart the server using the script if you have WAS Network Deployment. Otherwise you have to use the Stopserver and startserver scripts (same directory than wsadmin). If you have WAS installed as a windows service, you need to use 'net start <was service name>' instead of the sartserver script otherwise it will start as a user process instead of a service.
Peter Schuetze
I found that after the AdminConfig.save(), I did AdminApp.isAppReady and it returned false. I did a getDeployStatus (or something like that) and it returned "processing", where it was still extracting the binaries and such. My understanding is I have to wait until that is done before restarting the server. I am doing WAS Network Deployment. WAS is running on linux. I just found some sample scripts I am going to try out at http://www.ibm.com/developerworks/websphere/library/samples/SampleScripts.html
noplay
OK, that seems to be some WAS ND specifics. You don't need to do that for the non-clustered (not ND) version. AdminConfig.save() returns when it is done saving. For a non-clustered version you can start right away. In a clustered version, you just saved to the Deployment Manager. The Manager needs to propagate the changes to the cluster nodes. I think at this point AdminApp.isAppReady() comes into play.
Peter Schuetze
I found some useful sample auto deploy scripts on IBM at http://www.ibm.com/developerworks/websphere/library/samples/SampleScripts.html . The auto-deployment follows a practice that we do not employ, so I had to modify the jython scripts to do what I wanted to, but I was able to tailor them to suit my needs, plus I learned a little along the way. Thanks for your help.
noplay
A: 

The link to the scripts didn't show up right in my comment, so here it is: IBM SAMPLE SCRIPTS

noplay
A: 

This question is pretty old, but id like to show how we do this remotly. In this case with Ant

<target name="postbuild">
    <exec executable="C:\MyThinClient\wsadmin.bat" failonerror="true">
        <arg line="-conntype SOAP -host ${deployServer} -port ${deployPort} -user ${deployUser} -password ${deployPassword} -c" />
        <arg value="$AdminApp update ${projectName}EAR app {-operation update -contents {${artifactsDir}/${projectName}-${buildVersion}.ear}}" />
    </exec>
</target>

Given the correct setup of the wsadmin.bat you can run this from any server (without WAS installed) At least on WAS 6.1/7.0 ND this will only restart the application with the new binaries, not the whole server

Tommy