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
set lPorts [$AdminControl queryNames type=ListenerPort, cell=mycell,node=mynode,process=server1,*]
lPorts = AdminControl.queryNames('type=ListenerPort, cell=mycell,node=mynode,process=server1,*') print lPorts
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
foreach lPort $lPorts { set state [$AdminControl getAttribute $lport started] if {$state == "false"} { $AdminControl invoke $lPort start } }
# 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