Prior to every deployment of CA Repository for z/OS WebStation Option r7.2 (WSO), certain files need to be manually updated so that the application can start up successfully.
This knowledge document describes a suggested methodology that can be used to automate installation of WSO fixes in a Red Hat Enterprise Linux (RHEL) environment.
JDK or JRE 1.5.x or 1.6.x – Download JDK or JRE from Oracle website, http://www.oracle.com/technetwork/java/javase/downloads/index.html
After download is complete, make sure JAVA_HOME environment variable is set to Java home directory & PATH is set to include $JAVA_HOME/bin
E.g. If JDK is downloaded to /root/jdk1.6.0_45, use following commands,
export PATH=$PATH:/root/ jdk1.6.0_45/bin
Note. The java home directory may differ between a JDK or JRE installation. It is recommended to verify the java home directory structure before defining the variables above.
Apache Ant 1.7.0 –
It can be downloaded from, http://archive.apache.org/dist/ant/binaries/
After download is complete, make sure ANT_HOME environment variable is set to Ant home directory & PATH is set to include $ANT_HOME/bin.
E.g. if Ant is downloaded to /root/Ant1.7, use following commands,
export ANT_HOME=/root/Ant1.7/ apache-ant-1.7.0
export PATH=$PATH:/root/Ant1.7/ apache-ant-1.7.0/bin
AntContrib 1.0b3 –
AntContrib is a 3rd party, not an Apache software. But it works with Ant. More information can be found at, https://ant.apache.org/projects.html
It can be downloaded from download link from the home page, http://ant-contrib.sourceforge.net/
After download is complete, make sure CLASSPATH environment variable is set to absolute path of ant-contrib-1.0b3.jar.
E.g. if AntContrib is downloaded to /root/ant-contrib, use following command,
Note. There are several different packages available for download. Make sure to download the package that contains the actual jar file ‘ant-contrib-1.0b3.jar’ - ant-contrib-1.0b3-bin.zip.
BASH shell – Shell script makes use of BASH syntax. So it is mandatory make BASH the current shell before using the solution. Shell script fails on other shells like ksh, tcsh, etc.
Solution consists of 3 files contained in Automate WSO Fix Files.ZIP
build.properties – properties file to specify input parameters
build.sh – Shell script
build.xml – Ant script
build.properties file is where user can specify input parameters which are needed by script files to process EAR files. Following are the parameters,
CONTEXTROOT – Required only for WSO EAR. This value is updated into the application.xml inside EAR.
WSOLogProps – Required for both WSO & Admin Console EARs. This value is updated into the web.xml inside WSO72.war which is inside EAR.
WSOPropsFile - Required for both WSO & Admin Console EARs. This value is updated into the web.xml inside WSO72.war which is inside EAR.
JBOSSWEBXML - Required only for WSO EAR. User needs to create jboss-web.xml & specify absolute path to xml in this parameter. jboss-web.xml is inserted into WSO72.war which is inside EAR.
DATASOURCE - Required only for WSO EAR. This value is updated into web.xml & jboss-web.xml in WSO72.war which is inside EAR.
build.sh is a shell script which users need to invoke to modify EAR files. It actually does pre-processing & performs validations to before modifications can be performed on EAR files It accepts 3 parameters. Following is the syntax,
Syntax: bash build.sh <Absolute path of EAR file> <EAR Type> <Temporary directory name>
--help : Display this help message and exit. It must be the first parameter if specified.
All other parameters are ignored if --help is specified as first parameter.
<Absolute path of EAR file> : Absolute path of the location where EAR file exists along with EAR file name.
Enclose path in double quotes if it contains spaces.
<EAR Type> : 1 if <Absolute path of EAR file> specifies WSO EAR,
2 if <Absolute path of EAR file> specifies WSO Admin Console EAR.
<Temporary directory name> : Temporary directory will be created in the same directory where build.sh exists.
Sequence of the parameters should not be altered. --help & <Temporary directory name> are optional.
E.g. bash build.sh /root/WSOEApp_72_61_06092015.ear 1 temp
E.g. bash build.sh --help
Same information is displayed if user enters bash build.sh --help command at the command prompt.
First parameter is the absolute path of EAR file to be modified. Script creates a copy of this EAR file in a temporary directory specified in 3rd parameter. Temporary directory is created in the same directory where build.sh file exists. So path is not required, it expects only directory name. Second parameter is the type of EAR file; 1 for WSO EAR & 2 for Admin Console EAR.
Temporary directory is used by the script files to store intermediate files which are created during the process. Intermediate files include EAR file passed in as a first parameter to build.sh, jboss-web.xml which is specified in build.properties, files extracted from EAR & WAR. This EAR file is replaced with the modified EAR file as a part of modification process. Please make sure user has necessary privileges to create a directory in a directory where build.sh exists.
Temporary directory is not deleted after the process is complete.
build.xml is the Ant script which actually performs the modifications. Users should not invoke this file. It is invoked internally by build.sh.
How to use the solution?
jboss-web.xml: User needs to create jboss-web.xml and specify absolute path in JBOSSWEBXML parameter in build.properties. Please make sure user has necessary privileges to the directory containing jboss-web.xml.
Note: This solution uses simple find & replace method to update XML files. It searches for certain strings in XML files & replaces them with the inputs provided in build.properties.
E.g. application.xml is extracted from EAR file, script looks for search string. If it is located, replacement is done & modified application.xml is merged back in EAR.
In a similar way, web.xml is extracted from WAR file (which is extracted from EAR file) & merged back in WAR file after modification. (WAR file is then merged back in EAR file after WAR file modified.)
If scripts cannot find search strings in XML file, replacement does not take place & as a result the process fails. If you change search strings in XML files, make sure these search strings are reflected in Ant script files as well.
It is recommended that build.sh is invoked from command prompt. build.sh makes use of BASH syntax heavily. So make sure BASH shell is the current shell before shell script is invoked.
You can use “echo $0” command to find out the currently active shell. If it is not BASH shell, run “bash” command to change to BASH shell.
Make sure all necessary environment variables (JAVA_HOME, ANT_HOME, PATH, CLASSPATH) are set to correct values.
Users will have to invoke build.sh twice; once each for WSO EAR & Admin Console EAR.
To modify /root/WSOEApp_72_61_06092015.ear, navigate to the directory containing build.sh & run following command,
bash build.sh /root/WSOEApp_72_61_06092015.ear 1 temp1
To modify /root/WSOConfigurator_72_61_06092015.ear (Admin Console), navigate to the directory containing build.sh & run following command,
bash build.sh /root/WSOConfigurator_72_61_06092015.ear 2 temp2
If errors are encountered during process, these will be printed on console. If you see “BUILD SUCCESSFUL” message at the end, it means EAR is successfully modified. Modified EAR file can be found at the two locations;
· Original path which was passed in as first parameter to build.sh - You will need to make sure user has necessary privileges to overwrite original EAR file.
· Inside temporary directory.
Refer to the installation overview section in the CA Repository for z/OS WebStation Option Administration Guide located here