Execute wsadmin Script with UrbanCode Deploy

The WebSphere Application Server wsadmin tool provides the ability to automate configuration tasks for your environment . It supports a full range of product administrative activities such as configure and administer application servers, application deployment, and server runtime operations.

UrbanCode WAS Deploy plugin has a step called:  Execute wsadmin Script

Open the step:

choose the language between JACL and Jython and write your script into the Script Body.

Below a few examples of jython WAS useful scripts:

  • Map Resource References
AdminApp.edit('${p:appName}', ['-MapResRefToEJB', [[ '.*', '.*', '.*', '.*', 'javax.sql.DataSource', '${p:environment/application_datasource}']]])
  • Change Web Module Virtual Host
AdminApp.edit('${p:appName}', [' -MapWebModToVH', [[ '.*', '.*', '${p:environment/virtualhost}']]])
  • Modify Module Starting Weight
deployments = AdminConfig.getid('/Deployment:${p:appName}/')
deploymentObject = AdminConfig.showAttribute(deployments, 'deployedObject')
myModules = AdminConfig.showAttribute(deploymentObject, 'modules')
myModules = myModules[1:len(myModules)-1].split(" ")
for module in myModules:
 tmpStr = AdminConfig.showAttribute(module,'uri')
 if tmpStr == 'name.war':
 AdminConfig.modify(module, [['startingWeight', '6500']])
 if tmpStr == 'name2.war':
 AdminConfig.modify(module, [['startingWeight', '7000']])
  • Map Resource Environment References
AdminApp.edit('${p:appName}', ['-MapResEnvRefToRes', [[ '.*', '.*', '.*', '.*', 'javax.sql.DataSource', '${p:environment/application_datasource}']]])
  • Change JSP and JSF options
AdminApp.edit('${p:appName}', '[ ]' )
AdminTask.modifyJSFImplementation('${p:appName}', '[-implName SunRI1.2]') 

Have a nice day!

Middleware Analyst specialized on IBM UrbanCode Deploy (uDeploy), WebSphere Application Server (WAS), WebSphere MQ (WMQ), *NIX systems at CSE Consorzio Servizi Bancari - Bologna, Italy

Leave a Reply

Your email address will not be published. Required fields are marked *

13 + 11 =