WebSphere Application Server & Liberty

WebSphere Application Server & Liberty

Join this online group to communicate across IBM product users and experts by sharing advice and best practices with peers and staying up to date regarding product enhancements.

 View Only
  • 1.  jython script is not executing?can any one correct it?

    Posted Sat February 23, 2013 11:15 AM
    I am trying to execute this below code:
    import sys
    import java.lang.System as sys
    servers=AdminControl.queryNames('WebSphere:type=Server,*').splitlines()
    for server in servers:
    name=AdminControl.getAttribute(Server,'name') pid=AdminControl.getAttribute(Server,'pid')
    print "server=" + name + "pid=" + pid


    when i execute this script i am getting error:
    i am executing in WAS 6.0 in linux

    [root@localhost bin]# ./wsadmin.sh  -lang jython -f '/tmp/vimala/test4.py'

    WASX7209I: Connected to process "dmgr" on node dmgrnode using SOAP connector;  The type of process is: DeploymentManager


    WASX7017E: Exception received while running file "/tmp/vimala/test4.py"; exception information: com.ibm.bsf.BSFException: exception from Jython:


    Traceback (innermost last):


      (no code object) at line 0


      File "", line 5


            name=AdminControl.getAttribute(Server,'name')


            ^


    SyntaxError: invalid syntax


     


  • 2.  jython script is not executing?can any one correct it?

    Posted Tue February 26, 2013 06:45 AM
    import sys
    import java.lang.System as sys
    servers=AdminControl.queryNames('WebSphere:type=Server,*').splitlines()
    for server in servers:
        name=AdminControl.getAttribute(Server,'name')
        pid=AdminControl.getAttribute(Server,'pid')
        print "server=" + name + "pid=" + pid
    ====================================
    When you use jython (python).... spaces, indents etc are very important.
    I suggest you to use 'notepad++' , using which you can highlight the syntax for almost every scripting lang.