Automating Maximo Undeploy/Redeploy

Considerations when deploying Maximo changes

This article was written in 2016 and references a version of Maximo that has been superseded.

Anyone who has done any development work on Maximo knows that logging into WebSphere and starting, stopping, and redeploying EARs can be very time-consuming, not to mention that “Groundhog Day” feeling that you get from performing the same steps over and over! Thankfully, scripting these steps is a fairly easy and straightforward task using the Command Assistance Tool included in WebSphere. I normally place these in the Maximo/Deployment directory as I am often in there building EARs (assuming that your Maximo install directory is on the same server as your WebSphere administration console since these scripts to be ran from the server that the deployment manager profile is installed on). For a standard Maximo installation running on a WebSphere application server, you are going to want to use a set of scripts similar to the following:

  • Stop Applications or Application Server.
  • Undeploy/deploy a single EAR.
  • Undeploy/deploy all EARS.
  • Start Applications or Application Server.

To begin all of the above scripts will require either a CMD (Windows) or SH (Linux) command file to execute the scripts. For example, StopApplications.cmd. For these commands the basic format is the same. For example, to stop an application server (make sure to remove the spaces in the tags):

StopApplications.cmd
< WebSphere Home >\bin\wsadmin -lang jython -username < Admin User > -password < Admin Password > -f StopApplications.py

Where StopApplications.py is a Python script that stops your Maximo servers.

Next we need to build the StopApplications.py file to perform the actions we are scripting. Log into WebSphere and go to the All Servers screen. Click on “View administrative scripting command for last action”.

middleware-services-websphere

If prompted, click Continue. Now you should see the Administrative Scripting Commands window. Click Preferences and make sure the box for “Log Command Assistance Commands” is checked, then click apply and close the window.

Now got to All Applications, stop your Maximo applications and click on “View Administrative scripting command for last action”. You should see something similar to the following:

Administrative Scripting Commands

This is the command that WebSphere actually uses to perform that action. Now at this point you can either copy and replace the command into your script, or since you turned on the command logging you can go out to \profiles\ctgDmgr01\logs\dmgr and open the commandAssistanceJythonCommands_.log and copy the commands from there. Either way, when you are done you will have StopApplications.py that contains something similar to the following:

StopApplications.py
AdminControl.invoke('WebSphere:name=ApplicationManager,process=MXServer,platform=proxy,node=ctgNode01,version=8.5.5.10,type=ApplicationManager,mbeanIdentifier=ApplicationManager,cell=ctgCell01,spec=1.0', 'startApplication', '[MAXIMO]') 
AdminControl.invoke('WebSphere:name=ApplicationManager,process=MXServer,platform=proxy,node=ctgNode01,version=8.5.5.10,type=ApplicationManager,mbeanIdentifier=ApplicationManager,cell=ctgCell01,spec=1.0', 'startApplication', '[MXIEHS]')AdminControl.invoke('WebSphere:name=ApplicationManager,process=MXServer,platform=proxy,node=ctgNode01,version=8.5.5.10,type=ApplicationManager,mbeanIdentifier=ApplicationManager,cell=ctgCell01,spec=1.0', 'startApplication', '[maximo-x_war]')

Now to test! Return to WebSphere, go to All Applications, and start your Maximo applications. Once the applications have restarted, open a command/terminal window and go to the Maximo\Deployment directory and run the StopApplications.cmd or .sh file. Now if you go back into WebSphere you will see that the applications have been stopped. The process for generating the rest of the scripts is identical. Perform the procedure in WebSphere, go to the log and copy/paste the commands you want. This process works even better for clustered environments.