Link to home
Create AccountLog in
Avatar of prreddy
prreddy

asked on

Websphere Jython script

Hi,
i am working on Websphere and do most of the configuration settings and deployments using adminconsole. I would like to execute wsadmin commands using jython scripting...I created jython file and try to execute but i coudn't succeed...I am getting this exception...Appreciate if anyone help on this...


thanks,
-raj
import sys
#def list1(location, nodeName, serverName):
 
   # seting globals
   #--------------------------------------
   global AdminApp
   global AdminControl
   global AdminConfig
   global Help
 
    # checking 
   #--------------------------------------------------------------
   cellName = AdminControl.getCell()
   node = AdminConfig.getid("/Node:" + nodeName + "/")
   print "checking for existence of node " + nodeName
   if len(node) == 0:
      print "Error -- node not found for name " + nodeName
      return 
 
   # list the existing applications 
   #---------------------------------------------------------
   apps = AdminApp.list()
   print "Installed applications: "
   print apps
 
 ------------------------------------------
Exception:
------------------------------------------
WASX7015E: Exception running command: "execfile("list1.py")"; exception information:
 com.ibm.bsf.BSFException: exception from Jython:
Traceback (innermost last):
  File "<input>", line 1, in ?
  File "list1.py", line 36
           global AdminApp
           ^
SyntaxError: invalid syntax

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of HonorGod
HonorGod
Flag of United States of America image

Link to home
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
See answer
Avatar of prreddy
prreddy

ASKER

Excellent. it works fine...don't know why it didn't accept if you start at 2nd or 3rd column...
Whitespace is significant is Jython and the parent language Python.
Thanks for the grade & points.

Good luck & have a great day