How to find Websphere Version in python/jython scripts WAS

How to find WebsphereVersion(Exact build number) in python/jython scripts ?

The following lines of code will give the exact WAS version along with build number when used in a jython or python script.

wsadminNode = AdminControl.getNode()
print wsadminNode
wsadminSvr = AdminControl.queryNames("node="+wsadminNode+",type=Server,*")
print wsadminSvr
#wsadminVers = AdminControl.getAttribute(wsadminSvr, "platformVersion")
# The above line also gives us the WAS version but it will not give the exact build number details.
wsadminSvrON = AdminControl.makeObjectName(wsadminSvr)
wsadminVers = wsadminSvrON.getKeyProperty('version')
print  wsadminSvr

Hope this helps in finding the WAS versions in a jython/python script.

The above when run with wsadmin.sh script some times it throws the following error.
AppSrv01\bin>wsadmin.bat -conntype NONE -javaoption -Xmx384m -f  C:/kb/1321CDSUpdateAPP.py -lang jython  -appServerName CDSServer  -logDir C:/kb -logFile test.log  -appFileName "C:\\kb\\test.txt"  -appName CDS -controlFile c:/kb/test.txt

2010-02-25 02:41:40 CDSUpdateAPP.py main ERROR ('Update of application failed:', , com.ibm.ws.scripting.ScriptingException: AdminControl service not available)

 The above error can be rectified by passing the hostname explicitly or else by changing the connection type to RMI and RMI port. When we run the above lines of code using connType none as below
./wsadmin.sh  -conntype NONE -javaoption -Xmx384m -f /opt/builds/1321CDSUpdateAPP.py -lang jython  -appServerName CDSServer  -logDir /opt/builds -logFile test.log -appFileName /opt/builds/test.txt -appName CDS -controlFile /opt/IBM/WebSphere/AppServer/bin/testctrl.txt
It may through the error above we have seen
Solution for this will be
 -host with complete hostname or ipaddr is the alternate solution, since its a failure with Java
probably we can try  InetAddress.getAllByName(host)  in a standalone Java program and try to resolve it the same solution will apply to wsadmin as well.
Using Connection type RMI
./wsadmin.sh -conntype RMI -port 2809 -lang jython -javaoption -Xmx384m -f /opt/builds/1321CDSUpdateAPP.py -appServerName CDSServer  -logDir /opt/builds -logFile test.log -appFileName /opt/builds/test.txt -appName CDS -controlFile /opt/IBM/WebSphere/AppServer/bin/testctrl.txt
Using Host name and removing connection type NONE
./wsadmin.sh  -host nc145002.tivlab.austin.ibm.com -lang jython -javaoption -Xmx384m -f /opt/builds/1321CDSUpdateAPP.py -appServerName CDSServer  -logDir /opt/builds -logFile test.log -appFileName /opt/builds/test.txt -appName CDS -controlFile /opt/IBM/WebSphere/AppServer/bin/testctrl.txt


P.S: To find the different connection types and ports used by the Websphere installation, try open the Administration console using the url http://:9060/ibm/console/ in browser.


1 comments to "How to find Websphere Version in python/jython scripts WAS"

Post a Comment

Whoever writes Inappropriate/Vulgar comments to context, generally want to be anonymous …So I hope U r not the one like that?
For lazy logs, u can at least use Name/URL option which doesn’t even require any sign-in, The good thing is that it can accept your lovely nick name also and the URL is not mandatory too.
Thanks for your patience
~Krishna(I love "Transparency")

Popular Posts

Enter your email address:

Buffs ...

Tags


Powered by WidgetsForFree

Archives