We help IT Professionals succeed at work.
Get Started

Websphere Jython script

prreddy
prreddy asked
on
2,053 Views
Last Modified: 2013-12-10
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

Comment
Watch Question
Software Engineer
CERTIFIED EXPERT
Commented:
This problem has been solved!
Unlock 1 Answer and 3 Comments.
See Answer
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE