Sample Scripts for WebSphere Application Server

These sample jacl and Jython scripts let you automate common administation tasks and configure security in WebSphere Application Server Versions. The versions that the scripts apply to are noted. Download them and run them as is, or modify them to suit your environment.

August 2012 (First published April 2010)

These sample jacl and Jython scripts let you automate common administation tasks and configure security in WebSphere Application Server Versions. The versions that the scripts apply to are noted. Download them and run them as is, or modify them to suit your environment.

  • The sample scripts that export, import, and synchronize existing configuration objects run on WebSphere Application Server V8.
  • The sample admin script and the script library package for the Feature Pack for Communications Enabled Applications run on WebSphere Application Server version 7.
  • The automated deployment sample runs on WebSphere Application Server versions 5.0, 5.1, and 6.0
  • The security configuration samples run on WebSphere Application Server Version 5 and WebSphere Application Server - Express, Version 5 and on WebSphere Application Server Version 6 and 6.1. There is one download that contains the samples for versions 5 and 5.1, one for version 6, and another for version 6.1.
  • The administration samples run on WebSphere Application Server versions 5.0, 5.1, and 6.0. (The Jython versions of the administration scripts only run on versions 5.1 and 6.0)
  • The configuration change samples run on version 5.1.1 and on version 6.

The hardware and software requirements for these samples are the same as for the products on which they run.

Scripts for WebSphere Application Server Version 8

Download sample scripts that export, import, and synchronize existing configuration objects for WebSphere Application Server. This version has been created for individual installations of WebSphere Application Server 8.0, but the commands can be sequenced to perform the required tasks in network deployment installations.

To export data, you must specify the type of objects, the scope, and a local file system folder to write data to. Subsequently, all objects exported to this location can be recreated with one import operation. Additionally, another script is provided to match previously exported DataSource objects to existing JDBC Providers, and import them accordingly. Details and usage instructions are located at the beginning of each file.

  • objsExport.py - exports to local file system, all the configuration objects of a given type, belonging to a given scope.
  • objsImport.py - imports all the configuration objects found in a given folder.
  • syncDataSources.py - attempts to match exported DataSource objects to existing JDBC providers and imports them accordingly.

Scripts for WebSphere Application Server Version 7 administration

Download the IBM WebSphere Application Server Sample Script (wsadminlib.py package). This package is a single large sample script file with hundreds of methods. It is intended to simplify configuration of the WebSphere Application Server via scripting, by providing much-improved understandability and ease-of-use. The underlying scripting syntax for configuring the WAS product can be complex and challenging to understand. The wsadminlib package was created to provide simple method names and simple parameter names. These methods perform tasks such as creating servers, starting servers, and querying and setting numerous configuration options. Consumers may invoke wsadminlib.py directly in their configuration scripts, or they may use its contents as a sample code reference. The benefit is speedier development of scripts and testcases, and reduced errors.

Download the WebSphere Application Server V7.0 Feature Pack for Communications Enabled Applications (CEA) script library package (AdminCEA.py.zip). This package is a wsadmin script library file that includes procedures for configuring and displaying the settings associated with the Feature Pack for CEA. The following tasks are supported:

  • Defining the context root and virtual host for the CEA communications service application.
  • For a given server or cluster, defining the state of the CEA communications service application, REST interface maximum hold time, telephony access method, and related telephony interface settings.
  • Creating, modifying, and deleting custom SIP application routers.
  • Moving a server or a cluster to the default SIP application router or a custom SIP application router.
  • Showing the targets assigned to the default SIP application router and the startup order (weight) of the applications deployed on each target.
  • Showing the targets assigned to custom SIP application routers.

Scripts for WebSphere Application Server automated deployment

Download (version 3.1 May 2007) example scripts for automating deployment of Enterprise Application Archives (EARs) into WebSphere Application Servers. It also includes a PDF of an article explaining the scripts. These scripts may be downloaded anywhere on a system containing a WebSphere installation. When the ZIP is expanded it creates a directory AdderDeploy, which contains an TestDeploy program which performs the following tasks:

  • Dynamically read a Distribution Directory to determine what EARs need to be installed or updated or reconfigured or uninstalled.
  • Use environment/stage specific property files to determine the targets (Nodes/Servers and/or Clusters) and the application settings.
  • Calculate the unique set of affected Nodes and Servers, (to avoid unnecessary interruptions to others)
  • Perform a phased update of the affected Nodes and Servers to assist in maintaining high availability (and has hook-points for customer work-flow rerouting to further maintain availability).
  • The 3.0 version and above contain both Jacl and Jython versions of the AutoDeploy scripts. The Jython scripts were created using the IBM Jacl-2-Jython conversion assistant, available from the WebSphere support site as download swg24012144 . Note that the Jython AutoDeploy scripts require WebSphere Application Server verrsion 6.1, since the scripts require the complete Jython library (only shipped with version 6.1 and above).
  • The 3.1 version uses an application.scripts property file to specify user scripts to be loaded and executed preInstall, postInstall, preUninstall, and postUninstall.

Scripts for WebSphere Application Server security configuration

Download a set of files for configuring WebSphere Application Server security:

  • SecConfigProps.properties - a sample file with all available security properties, including the cipher suites which are used in SSL config.Security levels.
  • SecConfigProcs.jacl - low level procedures which are necessary to configure security and are called by the other security scripts.
  • SecConfigMenu.jacl - text menu choices for interactive mode, similar to security configuration choices found on the web-based WebSphere administrative console .
  • SecConfigBatch.jacl - configuration procedures that read and parse the properties from a property file which specify the security configuration values to set in batch mode.
  • readme.txt - detailed information about each script, what they do, and how to run them.

Scripts for WebSphere Application Server configuration changes

Download sample scripts that change, export, and import existing configuration data for WebSphere Application Server. Versions of these scripts are available for WebSphere Application Server 5.1.1 and for version 6. For the version 6 scripts in the Network Deployment environment, the scripts can be used in mixed cell environment where WebSphere Deployment Manager is Version 6 and all other federated WebSphere Application Servers can be Version 5.1.1 and/or Version 6.

These scripts are invoked through ws_ant. Scripts that perform the following tasks are included:

  • change host name
  • change cell name
  • change node name
  • change server name
  • export/import the whole repository config directory
  • export/import individual application server
  • export/import enterprise application
  • export/import JDBC Provider with associate Data Sources

Scripts for WebSphere Application Server administration

Download sample scripts that perform common administration functions:

  • Create and modify a server, load an application onto the server, and start the server.
  • Stop a server on a given node, uninstall an application, and remove the server from the configuration.
  • Create a server group on the server, and start the server (requires Network Deployment configuration).
  • Invoke useful problem-determination actions involving traces and thread dump.
  • Invoke various application install commands.
  • Invoke commands that produce a short summary of configuration and runtime information about the WebSphere installation.
  • Creation JDBCProvider object using a template.
  • Demonstrate J2C Security configuration by installing a J2CResourceAdapter and creating a J2CConnectionFactory.
  • Create JDBCProvider, DataSource and CMPConnectorFactory objects.
  • Create use a variable for a URLProvider object.
  • Set port numbers kept in the serverindex.xml file.
  • Update configuration attributes that are presented in lists or lists of objects.
  • List all enterprise applications installed on a specific application server. (separate download)

Downloads

DescriptionNameSize
WebSphere import/export scriptswas_exportimport_v8.zip8 KB
WebSphere administration scriptswsadminlib.py.zip85 KB
Feature Pack for CEA script library AdminCEA.py.zip8 KB
WebSphere automated deployment scriptsAutoDeploy_v31.zip  ( HTTP | FTP )355 KB
Security scripts for versions 5.0 and 5.1was_security_cfg_v5.zip  ( HTTP | FTP )30 KB
WebSphere security scripts for version 6.0was_security_cfg.zip  ( HTTP | FTP )30 KB
WebSphere security scripts for version 6.1was_security_cfg_v61.zip  ( HTTP | FTP )30 KB
Configuration management scripts for V5.1.1exportimport.zip  ( HTTP | FTP )40 KB
Configuration management scripts for V6ConfigScripts.zip  ( HTTP | FTP )50 KB
WebSphere administration scripts (1-12)wsadminExampleScripts.zip  ( HTTP | FTP )0.3 MB
Administration scripts (1-12) -- Jython versionwsadminJythonExampleScripts.zip  ( HTTP | FTP )0.3 MB
WebSphere administration script 13wsadminEx13.zip  ( HTTP | FTP )3 KB
static.content.url=http://www.ibm.com/developerworks/js/artrating/
SITE_ID=1
Zone=WebSphere
ArticleID=166422
SummaryTitle=Sample Scripts for WebSphere Application Server
publish-date=082012