Updating wps.ear using WSAdmin Script

The WebSphere Portal engine is implemented as J2EE application. The portal engine logic is implemented in wps.ear. These are some of the use cases in which you might want to update the wps.ear


  • You want to introduce a new THeme or Skin or something that is deployed as part of wps.ear

  • You might want to add Servlet Filter to do some pre/post processing on the portal engine requests.



I am working on creating a new Theme and Skin and as part of that i need to update the wps.ear frequently and i follow these steps to update wps.ear using wsadmin script

  • First connect to wsadmin console for WebSphere Portal, you can do that by executing following command

    ./wsadmin.sh -user wasadmin -password wasadmin -lang jython -port 10033

    By default the portal is configured to listen on 10033 port for SOAP connection

  • THen execute AdminApp.export('appname','eardestinationpath') command on the wsadmin consoel and it will export the installed application into .ear

    AdminApp.export('wps','/tmp/wpsear/wps.ear')

    In this case i am export wps enterprise application into /tmp/wpsear/wps.ear

  • The wps.ear contains 3 .war files and one .ejb.jar file. I can use either normal jar utility to expand the .ear first and then expand .war files in the .ear file or i can use EARExpander utility which is part of WAS and available even in profile_home/bin directory to expand the .ear file

    ./EARExpander.sh -ear /tmp/wpsear/wps.ear -operationDir /tmp/wpsear -operation expand -expansionFlags all

    This will expand the wps.ear and the .war files inside into /tmp/wpsear directory

  • Now you can apply your changes by either copying new theme or skin related directory or modifying the web.xml file for adding filter definition

  • We can use the EARExpander utility to collapsing the content of directory into .ear file using command like this

    ./EARExpander.sh -ear /tmp/wps.ear -operationDir /tmp/wpsear -operation collapse


  • Once the updated wps.ear is ready we can use the following wasadmin command to update the .ear file on the server

    AdminApp.update('wps', 'app', '[ -operation update -contents /tmp/wps.ear -nopreCompileJSPs -installed.ear.destination $(APP_INSTALL_ROOT)/DefaultNode -distributeApp -nouseMetaDataFromBinary -nodeployejb -createMBeansForResources -noreloadEnabled -nodeployws -validateinstall warn -processEmbeddedConfig -filepermission .*\.dll=755#.*\.so=755#.*\.a=755#.*\.sl=755 -noallowDispatchRemoteInclude -noallowServiceRemoteInclude]' )


  • Last step would be to commit changes in the WAS configuration, at this point the WAS xml configuration files will actually get modified

    AdminConfig.save()


1 comment: