WAS 6.1: Change initial state of listener ports with scripting(jython) - Websphere

This is a discussion on WAS 6.1: Change initial state of listener ports with scripting(jython) - Websphere ; Hi! How can I change with a Jython script the initial state to "start" or "stop" of a listener port? I attempt do it with the command: {code}AdminConfig.modify(AdminControl.queryNames(' type=ListenerPort,process=ms1-1,name=Listener_AENWSAUSNAHMELISTE0101.REQUEST,*') , [['StateManageable', [['initialState', 'STOP']]]]){code} but I get an Exception: {code}WASX7015E: Exception ...

+ Reply to Thread
Results 1 to 5 of 5

Thread: WAS 6.1: Change initial state of listener ports with scripting(jython)

  1. WAS 6.1: Change initial state of listener ports with scripting(jython)

    Hi!

    How can I change with a Jython script the initial state to "start" or "stop" of a listener port?
    I attempt do it with the command:

    {code}AdminConfig.modify(AdminControl.queryNames(' type=ListenerPort,process=ms1-1,name=Listener_AENWSAUSNAHMELISTE0101.REQUEST,*') , [['StateManageable', [['initialState', 'STOP']]]]){code}

    but I get an Exception:

    {code}WASX7015E: Exception running command: "AdminConfig.modify(AdminControl.queryNames('type=L istenerPort,process=ms1-1,name=Listener_AENWSAUSNAHMELISTE0101.REQUEST,*') , [['StateManageable', [['initialState', 'STOP']]]])"; exception information:
    com.ibm.ws.scripting.ScriptingException: WASX7077E: Incomplete config id: need closing parenthesis in "WebSphere:name=Listener_AENWSAUSNAHMELISTE0101.REQ UEST,process=ms1-1,platform=proxy,node=Q4DE8PSAWAENode02,version=6. 1.0.21,type=ListenerPort,mbeanIdentifier=cells/ghb1nw205Cell/nodes/Q4DE8PSAWAENode02/servers/ms1-1/server.xml#ListenerPort_1238570801115,cell=ghb1nw2 05Cell,spec=1.0"{code}

    Thanks for your answer!

  2. Re: WAS 6.1: Change initial state of listener ports with scripting(jython)

    Hi.

    You are trying to treat it as an MBean which it is not.

    Try the following:

    lp = 'lp1(cells/L3A3316Node04Cell/nodes/L3A3316Node04/servers/server1|server.xml#ListenerPort_1250594097000)'
    AdminConfig.modify(AdminConfig.showAttribute(lp, "stateManagement"), "[[initialState 'STOP']]")

    Cheers, Matt.

  3. Re: WAS 6.1: Change initial state of listener ports with scripting(jython)

    Hi!

    The string {code}cells/L3A3316Node04Cell/nodes/L3A3316Node04/servers/server1|server.xml#ListenerPort_1250594097000{code } is the mbeanIdentifier of the listener port, how can I get this for all listeners of a server beased on the listeners and the servers name?

  4. Re: WAS 6.1: Change initial state of listener ports with scripting(jython)

    Hi.

    It's the config id which is used to reference the listener port in the config model. Here is an example for converting all listener ports for a given server. This also corrects my cut and paste error from earlier:

    serverName = "server1"
    mls = AdminConfig.getid("/Server:" + serverName + "/ApplicationServer:/EJBContainer:/MessageListenerService:/")
    lpListUnsplit = AdminConfig.showAttribute(mls, "listenerPorts")
    lpList = (lpListUnsplit[1:len(lpListUnsplit)-1]).split(" ")
    for lp in lpList:
    AdminConfig.modify(AdminConfig.showAttribute(lp, "stateManagement"), "[[initialState STOP]]")
    AdminConfig.save()

  5. Re: WAS 6.1: Change initial state of listener ports with scripting(jython)

    The penultimate line needs to be tabbed in as it is part of the loop whereas the last one isn't.

+ Reply to Thread