Thanks to the author of the Clever Monkey blog (http://ksoni-java.blogspot.co.uk/2010/03/wsadmin-thin-client.html) for this one.
The key advantage of this is that you can run it anywhere so long as you have Java installed ... i.e. you don't need WebSphere, instead you need just two jars
- com.ibm.ws.admin.client_7.0.0.jar (you can find this under $WAS_HOME/runtimes)
- com.ibm.ws.security.crypto.jar (you can find this under deploytool/itp/plugins/com.ibm.websphere.v7*/plugins)
You might wonder why you need to set $WAS_HOME.... I don't know the answer but I do know that $WAS_HOME only needs to point to the directory that contains your wsadmin.sh script, I guess it's just a hard coded throwback.
NOTE: I did have one problem whereby I was unable to import the regular expression package (import re). I thought I'd be able to find a jar with everything I needed but in the end I just copied the following py files from an existing WAS install ($WAS_HOME/optionalLibraries/jython/Lib) to the same dir as my wsadmin.sh script (couldn't work out how to use them if they were placed in a different directory)
- copy_reg.py
- javaos.py
- javapath.py
- re.py
- sre_compile.py
- sre_constants.py
- sre_parse.py
- sre.py
- string.py
- UserDict.py
Here's my wsadmin.sh
#!/bin/sh
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Set paths
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
WAS_HOME=/opt/bpm/scripts/certCheck
USER_INSTALL_ROOT=${WAS_HOME}
JAVA_HOME=/opt/bpm/bpm751/java
JAVA_EXE=${JAVA_HOME}/bin/java
CLASSPATH=${WAS_HOME}/lib/com.ibm.ws.admin.client_7.0.0.jar:${WAS_HOME}/lib/com.ibm.ws.security.crypto.jar
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Set location of properties files
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
SOAPURL=-Dcom.ibm.SOAP.ConfigURL=file:${WAS_HOME}/props/soap.client.props
CLIENTSSL=-Dcom.ibm.SSL.ConfigURL=file:${WAS_HOME}/props/ssl.client.props
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Trace settings
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
wsadminTraceString=-Dcom.ibm.ws.scripting.traceString=*=off
wsadminTraceFile=-Dcom.ibm.ws.scripting.traceFile=wsadmin.traceout
wsadminValOut=-Dcom.ibm.ws.scripting.validationOutput=wsadmin.valout
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Process command line arguments
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
isJavaOption=false
nonJavaOptionCount=1
for option in "$@" ; do
if [ "$option" = "-javaoption" ] ; then
isJavaOption=true
else
if [ "$isJavaOption" = "true" ] ; then
javaOption="$javaOption $option"
isJavaOption=false
else
nonJavaOption[$nonJavaOptionCount]="$option"
nonJavaOptionCount=$((nonJavaOptionCount+1))
fi
fi
done
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Run the command
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
${JAVA_EXE} \
-classpath "$CLASSPATH" \
-Duser.install.root=$USER_INSTALL_ROOT \
-Dwas.install.root=$USER_INSTALL_ROOT \
$CLIENTSSL \
$SOAPURL \
$wsadminValOut \
$wsadminTraceString \
-Dcom.ibm.websphere.thinclient=true \
com.ibm.ws.scripting.WasxShell ${nonJavaOption[@]}
No comments:
Post a Comment