WebSphere Application Server Network Deployment, Version 6.0.x     Operating Systems: AIX, HP-UX, Linux, Solaris, Windows

Starting listener ports using scripting

Before you begin

Before starting this task, the wsadmin tool must be running. See the Starting the wsadmin scripting client article for more information.

Why and when to perform this task

Perform the following steps to start a listener port on an application server. The following example returns a list of listener port MBeans:

Steps for this task

  1. Identify the listener port MBeans for the application server and assign it to the lPorts variable.
    • Using Jacl:
      set lPorts [$AdminControl queryNames type=ListenerPort,
      cell=mycell,node=mynode,process=server1,*]
    • Using Jython:
      lPorts = AdminControl.queryNames('type=ListenerPort,
      cell=mycell,node=mynode,process=server1,*')
      print lPorts
    Example output:
    WebSphere:cell=mycell,name=ListenerPort,mbeanIdentifier=server.xml#
    ListenerPort_1,type=ListenerPort,node=mynode,process=server1
    WebSphere:cell=mycell,name=listenerPort,mbeanIdentifier=ListenerPort,
    type=server.xml#ListenerPort_2,node=mynode,process=server1
  2. Start the listener port if it is not started. For example:
    • Using Jacl:
      foreach lPort $lPorts {
           set state [$AdminControl getAttribute $lport started]
           if {$state == "false"} {
              $AdminControl invoke $lPort start
           }
        }
    • Using Jython:
      # get line separator 
      import  java
      lineSeparator = java.lang.System.getProperty('line.separator')
      
      lPortsArray = lPorts.split(lineSeparator)
      for lPort in lPortsArray:
      	state = AdminControl.getAttribute(lPort, 'started')
      	if state == 'false':
      		AdminControl.invoke(lPort, 'start')

    These pieces of Jacl and Jython code loop through the listener port MBeans. For each listener port MBean, get the attribute value for the started attribute. If the attribute value is set to false, then start the listener port by invoking the start operation on the MBean.




Related concepts
AdminControl object for scripted administration

Related reference
Commands for the AdminControl object

Task topic    

Terms of Use | Feedback

Last updated: Mar 17, 2005 4:28:29 AM CST
http://publib.boulder.ibm.com/infocenter/ws60help/index.jsp?topic=/com.ibm.websphere.nd.doc/info/ae/ae/txml_startport.html

© Copyright IBM Corporation 2004, 2005. All Rights Reserved.
This information center is powered by Eclipse technology. (http://www.eclipse.org)