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
Expand all | Collapse all

jython script error?can any one correct thsi code below?

  • 1.  jython script error?can any one correct thsi code below?

    Posted Sat February 23, 2013 02:27 PM

    #----------------------------------------------------------------
    # lines 7 and 8 find all the cell and process them one at a time
    #----------------------------------------------------------------
    # get line separator
    import java.lang.System as sys
    lineSeparator = sys.getProperty('line.separator')
    cells = AdminConfig.list('Cell').split(lineSeparator)
    for cell in cells:
    #----------------------------------------------------------------
    # lines 13 and 14 find all the nodes belonging to the cell and
    # process them at a time
    #-----------------------------------------------------------------
    nodes = AdminConfig.list('Node',cell).split(lineSeparator)
    for node in nodes:
    #--------------------------------------------------------------
    # lines 19-23 find all the running servers belonging to the cell
    # and node, and process them one at a time
    #--------------------------------------------------------------
    cname = AdminConfig.showAttribute(cell, 'name')
    nname = AdminConfig.showAttribute(node, 'name')
    servs = AdminControl.queryNames('type=Server,cell=' + cname +
    ',node=' + nname + ',*').split(lineSeparator)
    print "Number of running servers on node " +
    nname + ": %s \n" % (len(servs))
    for server in servs:
    #---------------------------------------------------------
    # lines 28-34 get some attributes from the server to display;
    # invoke an operation on the server JVM to display a property.
    #---------------------------------------------------------
    sname = AdminControl.getAttribute(server, 'name')
    ptype = AdminControl.getAttribute(server, 'processType')
    pid = AdminControl.getAttribute(server, 'pid')
    state = AdminControl.getAttribute(server, 'state')
    jvm = AdminControl.queryNames('type=JVM,cell=' +
    cname + ',node=' + nname + ',process=' + sname + ',*')
    osname = AdminControl.invoke(jvm, 'getProperty', 'os.name')
    print " " + sname + " " + ptype + " has pid " + pid +
    "; state: " + state + "; on " +
    osname + "\n"


    #---------------------------------------------------------
    # line 40-45 find the applications running on this server and
    # display the application name.
    #---------------------------------------------------------
    apps = AdminControl.queryNames('type=Application,cell=' +
    cname + ',node=' + nname + ',process=' + sname + ',*').
    split(lineSeparator)
    print "Number of applications running on " + sname +
    ": %s \n" % (len(apps))
    for app in apps:
    aname = AdminControl.getAttribute(app, 'name')
    print aname + "\n"
    print "----------------------------------------------------"
    print "\n"


    when i try to execute this script following error is getting:


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


    -bash: ./wsadmin.sh: No such file or directory


    [root@localhost /]# cd /opt/IBM/WebSphere/AppServer/profiles/Dmgr01/bin/


    [root@localhost bin]# ./wsadmin.sh -lang jython -f '/tmp/vimala/test3.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/test3.py"; exception information: com.ibm.bsf.BSFException: exception from Jython:


    Traceback (innermost last):


      (no code object) at line 0


      File "", line 13


            nodes = AdminConfig.list('Node',cell).split(lineSeparator)


            ^


    SyntaxError: invalid syntax

    i am using WAS 6.0 in linux 


     



  • 2.  jython script error?can any one correct thsi code below?

    Posted Tue February 26, 2013 08:25 AM
    Hi saravana,

      Joseph's answer your question.

      www.websphereusergroup.org/go/thread/vie...

    regards


  • 3.  jython script error?can any one correct thsi code below?

    Posted Tue February 26, 2013 09:13 AM
    thank you Gabriel