Commands for the AdminControl object using wsadmin.sh
Use the AdminControl object to invoke operational commands that manage objects for the application server.
Many of the AdminControl commands have multiple signatures so that they can either invoke in a raw mode using parameters specified by Java Management Extensions (JMX), or using strings for parameters. In addition to operational commands, the AdminControl object supports some utility commands for tracing, reconnecting with a server, and converting data types.
When using the commands available in the AdminControl object in large topologies, query and search with process=dmgr and type=Cluster. This method of searching is more efficient, less time consuming, and avoids searching all nodes.
The following commands are available for the AdminControl object:
- completeObjectName
- getAttribute
- getAttribute_jmx
- getAttributes
- getAttributes_jmx
- getCell
- getConfigId
- getDefaultDomain
- getDomainName
- getHost
- getMBeanCount
- getMBeanInfo_jmx
- getNode
- getObjectInstance
- getPort
- getPropertiesForDataSource (Deprecated)
- getType
- help
- invoke
- invoke_jmx
- isRegistered
- isRegistered_jmx
- makeObjectName
- queryMBeans
- queryNames
- queryNames_jmx
- reconnect
- setAttribute
- setAttribute_jmx
- setAttributes
- setAttributes_jmx
- startServer
- stopServer
- testConnection
- trace
completeObjectName
Create a string representation of a complete ObjectName value based on a fragment. This command does not communicate with the server to find a matching ObjectName value. If the system finds several Beans that match the fragment, the command returns the first one.
Target object: None.
Required parameters:
- object name
- Name of the object to complete. (ObjectName)
- template
- Name of the template to use. For example, the template might be type=Server,*. (java.lang.String)
Optional parameters: None.
Sample output
The command does not return output.
Examples
- Use Jacl:
set serverON [$AdminControl completeObjectName node=mynode,type=Server,*]
Use Jython: serverON = AdminControl.completeObjectName('node=mynode,type=Server,*')
getAttribute
Return the value of the attribute for the name that we provide.
If we use the getAttribute command to determine the state of an application, one of the following values is returned:
- 0 - which indicates that the application is starting
- 1 - which indicates that the application has started
- 2 - which indicates that the application is stopping
- 3 - which indicates that the application has stopped
- 4 - which indicates that the application failed to start
Target object: None.
Required parameters:
- object name
- Object name of the MBean of interest. (ObjectName)
- attribute
- Name of the attribute to query. (java.lang.String)
Optional parameters: None.
Sample output
The command returns a string containing the value of the attribute that you query, as the following example displays:
'DeploymentManager'
Examples
- Use Jacl:
set objNameString [$AdminControl completeObjectName WebSphere:type=Server,*] $AdminControl getAttribute $objNameString processType
Use Jython: objNameString = AdminControl.completeObjectName('WebSphere:type=Server,*') print AdminControl.getAttribute(objNameString, 'processType')
getAttribute_jmx
Return the value of the attribute for the name that we provide.
Target object: None.
Required parameters:
- object name
- Object name of the MBean of interest. (ObjectName)
- attribute
- Name of the attribute to query. (java.lang.String)
Optional parameters: None.
Sample output
The command returns a string containing the value of the attribute that you query, as the following example displays:
'DeploymentManager'
Examples
- Use Jacl:
set objNameString [$AdminControl completeObjectName WebSphere:type=Server,*] set objName [java::new javax.management.ObjectName $objNameString] $AdminControl getAttribute_jmx $objName processType
Use Jython: objNameString = AdminControl.completeObjectName('WebSphere:=type=Server,*') import javax.management as mgmt objName = mgmt.ObjectName(objNameString) print AdminControl.getAttribute_jmx(objName, 'processType')
getAttributes
Return the attribute values for the names provided.
Target object: None.
Required parameters:
- object name
- Object name of the MBean of interest. (ObjectName)
- attribute
- Names of the attributes to query. (java.lang.String[] or java.lang.Object[])
Optional parameters: None.
Sample output
The command returns a string containing the value of the attribute that you query, as the following example displays:
'[ [cellName myCell01] [nodeName myCellManager01] ]'
Examples
- Use Jacl:
set objNameString [$AdminControl completeObjectName WebSphere:type=Server,*] $AdminControl getAttributes $objNameString "cellName nodeName"
Use Jython with string attributes: objNameString = AdminControl.completeObjectname('WebSphere:type=Server,*) print AdminControl.getAttributes(objNameString, '[cellName nodeName]')
Use Jython with object attributes: objNameString = AdminControl.completeObjectname('WebSphere:type=Server,*) print AdminControl.getAttributes(objNameString, ['cellName', 'nodeName'])
getAttributes_jmx
Return the attribute values for the names provided.
Target object: None.
Required parameters:
- object name
- Object name of the MBean of interest. (ObjectName)
- attribute
- Names of the attributes to query. (java.lang.String[] or java.lang.Object[])
Optional parameters: None.
Sample output
The command returns an attribute list.
Examples
- Use Jacl:
set objectNameString [$AdminControl completeObjectName WebSphere:type=Server,*] set objName [$AdminControl makeObjectName $objectNameString] set attrs [java::new {String[]} 2 {cellName nodeName}] $AdminControl getAttributes_jmx $objName $attrs
Use Jython: objectNameString = AdminControl.completeObjectName('type=Server,*') objName = AdminControl.makeObjectName(objectNameString) attrs = ['cellName', 'nodeName'] print AdminControl.getAttributes_jmx(objName, attrs)
getCell
Return the name of the connected cell.
Target object: None.Required parameters: None.
Optional parameters: None.
Sample output
The command returns the cell name that you query:
Mycell
Examples
- Use Jacl:
$AdminControl getCell
Use Jython: print AdminControl.getCell()
getConfigId
Create a configuration ID from an ObjectName or an ObjectName fragment. Each MBean does not have corresponding configuration objects. If several Beans correspond to an ObjectName fragment, a warning is created and a configuration ID builds for the first MBean the system finds.
Target object: None.
Required parameters:
- object name
- Name of the object of interest. The object name string can be a wildcard, specified with an asterisk character (*).
Optional parameters: None.
Sample output
The command returns a string containing the configuration ID of interest.
Examples
- Use Jacl:
(Dist)
set threadpoolCID [$AdminControl getConfigId node=mynode,type=ThreadPool,*](ZOS)
set serverConfigId [$AdminControl getConfigId node=SY1,type=Server,*]
Use Jython: (Dist)
threadpoolCID = AdminControl.getConfigId('node=mynode,type=ThreadPool,*')(ZOS)
serverConfigId = AdminControl.getConfigId('node=SY1,type=Server,*')
getDefaultDomain
Return the default domain name from the server.
Target object: None.
Required parameters: None.
Optional parameters: None.
Sample output
The command returns a string containing the default domain name of interest:
WebSphere
Examples
- Use Jacl:
$AdminControl getDefaultDomain
Use Jython: print AdminControl.getDefaultDomain()
getDomainName
Return the domain name from the server.
Target object: None.
Required parameters: None.
Optional parameters: None.
Sample output
The command returns a string containing the domain name of interest:
WebSphere
Examples
- Use Jacl:
$AdminControl getDomainName
Use Jython: print AdminControl.getDomainName()
getHost
Return the name of our host.
Target object: None.Required parameters: None.
Optional parameters: None.
Sample output
The command returns a string containing the name of the host of interest:
myHost
Examples
- Use Jacl:
$AdminControl getHost
Use Jython: print AdminControl.getHost()
getMBeanCount
Return the number of MBeans that are registered in the server.
Target object: None.
Required parameters: None.
Optional parameters: None.
Sample output
The command returns an integer value containing the number of MBeans that are registered in the server:
151
Examples
- Use Jacl:
$AdminControl getMBeanCount
Use Jython: print AdminControl.getMBeanCount()
getMBeanInfo_jmx
Return the Java Management Extension MBeanInfo structure that corresponds to an ObjectName value. No string signature exists for this command, because the Help object displays most of the information available from the getMBeanInfo_jmx command.
Target object: None.Required parameters:
- object name
- Object name of the MBean of interest. (ObjectName)
Optional parameters: None.
Sample output
The command returns a javax.management.MBeanInfo object:
javax.management.modelmbean.ModelMBeanInfoSupport@10dd5f35
Examples
- Use Jacl:
set objectNameString [$AdminControl completeObjectName type=Server,*] set objName [$AdminControl makeObjectName $objectNameString] $AdminControl getMBeanInfo_jmx $objName
Use Jython: objectNameString = AdminControl.completeObjectName('type=Server,*') objName = AdminControl.makeObjectName(objectNameString) print AdminControl.getMBeanInfo_jmx(objName)
getNode
Return the name of the connected node.
Target object: None.Required parameters: None.
Optional parameters: None.
Sample output
The command returns a string containing the name of the node:
myNode01
Examples
- Use Jacl:
$AdminControl getNode
Use Jython: print AdminControl.getNode()
getObjectInstance
Return the object instance that matches the input object name.
Target object: None.
Required parameters:
- object name
- Name of the object of interest. (ObjectName)
Optional parameters: None.
Sample output
The command returns the object instance that matches the input object name:
javax.management.modelmbean.RequiredModelMBean
Examples
- Use Jacl:
set server [$AdminControl completeObjectName type=Server,*] set serverOI [$AdminControl getObjectInstance $server]Manipulate the return value of the getObjectInstance command:
puts [$serverOI getClassName]
Use Jython: server = AdminControl.completeObjectName('type=Server,*') serverOI = AdminControl.getObjectInstance(server)Manipulate the return value of the getObjectInstance command:
print serverOI.getClassName()
getPort
Return the name of the port used for the scripting connection.
Target object: None.
Required parameters: None.
Optional parameters: None.
Sample output
The command returns the port number of the port the system uses to establish the scripting connection:
8877
Examples
- Use Jacl:
$AdminControl getPort
Use Jython: print AdminControl.getPort()
getPropertiesForDataSource (Deprecated)
The getPropertiesForDataSource command is deprecated, and no replacement exists. This command incorrectly assumes the availability of a configuration service when running in connected mode.
Target object: None.
Required parameters: None.
Optional parameters: None.
Sample output
The command returns the following message:
WASX7389E: Operation not supported - getPropertiesForDataSource command is not supported.
Examples
- Use Jacl:
set ds [lindex [$AdminConfig list DataSource] 0] $AdminControl getPropertiesForDataSource $ds
Use Jython: ds = AdminConfig.list('DataSource') # get line separator import java.lang.System as sys lineSeparator = sys.getProperty('line.separator') dsArray = ds.split(lineSeparator) print AdminControl.getPropertiesForDataSource(dsArray[0])
getType
Return the connection type used for the scripting connection.
Target object: None.
Required parameters: None.
Optional parameters: None.
Sample output
The command returns a string containing the connection type for the scripting connection, as the following example displays:
SOAP
Examples
- Use Jacl:
$AdminControl getType
Use Jython: print AdminControl.getType()
help
Return general help text for the AdminControl object.
Target object: None.
Required parameters: None.
Optional parameters:
- command
- Command for which to return help information. The command name is not case-sensitive.
Sample output
The command returns a string that details specific options for the help command, as the following example displays:
WASX7027I: The AdminControl object enables the manipulation of MBeans running in a WAS process. The number and type of MBeans available to the scripting client depend on the server to which the client is connected. If the client is connected to a deployment manager, then all the MBeans running in the Deployment Manager are visible, as are all the MBeans running in the node agentsconnected to this deployment manager, and all the MBeans that run in the application servers on those nodes. The following commands are supported by the AdminControl object; more detailed information about each of these commands is available using the "help" command of the AdminControl object and supplying the name of the command as an argument. any of these commands support two different sets of signatures: one that accepts and returns strings, and one low-level set that works with JMX objects like ObjectName and AttributeList. In most situations, the string signatures are likely to be more useful, but JMX-object signature versions are supplied as well. Each of these JMX-object signature commands has "_jmx" appended to the command name, so an "invoke" command, as well as a "invoke_jmx" command are supported. completeObjectName Return a String version of an object name given atemplate name getAttribute_jmx Given ObjectName and name of attribute, returns value ofattribute getAttribute Given String version of ObjectName and name of attribute, returns value of attribute getAttributes_jmx Given ObjectName and array of attribute names, returns AttributeList getAttributes Given String version of ObjectName and attribute names, returns String of name value pairs getCell returns the cell name of the connected server getConfigId Given String version of ObjectName, return a config id for the corresponding configuration object, if any. getDefaultDomain returns "WebSphere" getDomainName returns "WebSphere" getHost returns String representation of connected host getMBeanCount returns number of registered beans getMBeanInfo_jmx Given ObjectName, returns MBeanInfo structure for MBean getNode returns the node name of the connected server getPort returns String representation of port in use getType returns String representation of connection type in use help help Show help information invoke_jmx Given ObjectName, name of command, array of parameters andsignature, invoke command on MBean specified invoke Invoke a command on the specified MBean isRegistered_jmx true if supplied ObjectName is registered isRegistered true if supplied String version of ObjectName is registered makeObjectName Return an ObjectName built with the given string queryNames_jmx Given ObjectName and QueryExp, retrieves set of ObjectNames that match. queryNames Given String version of ObjectName, retrieves String of ObjectNames that match. reconnect reconnects with serversetAttribute_jmx Given ObjectName and Attribute object, set attribute for MBean specified setAttribute Given String version of ObjectName, attribute name andattribute value, set attribute for MBean specified setAttributes_jmx Given ObjectName and AttributeList object, set attributes for the MBean specified startServer Given the name of a server, start that server. stopServer Given the name of a server, stop that server. testConnection Test the connection to a DataSource object trace Set the wsadmin trace specification
If we specify a specific command with the help command, the wsadmin tool returns detailed help about the command:
WASX7043I: command: getAttribute Arguments: object name, attribute Description: Returns value of "attribute" for the MBean described by "object name."
Examples
- Use Jacl:
$AdminControl help
$AdminControl help getAttribute
Use Jython: print AdminControl.help()
print AdminControl.help('getAttribute')
invoke
Invoke a specific MBean operation based on the number of parameters that operation requires. If this constraint is not sufficient to select a unique operation, use invoke_jmx. The supplied parameters are converted to the object types required by the selected operation's signature before the operation is invoked. Any returned value is converted to its string representation.
Target object: None.Required parameters:
- object name
- Object name of the MBean of interest.
- operation
- Operation to invoke.
Optional parameters:
- arguments
- Arguments required for the operation. If no arguments are required for the operation of interest, we can omit the arguments parameter.
The arguments parameter is a single string. Each individual argument in the string can contain spaces.
Sample output
The command returns a string that shows the result of the invocation.
Examples
- Use Jacl:
set objNameString [$AdminControl completeObjectName WebSphere:type=Server,*] $AdminControl invoke $objNameString stop
set objNameString [$AdminControl completeObjectName WebSphere:type=DynaCache,*] $AdminControl invoke $mbean getCacheStatistics {"DiskCacheSizeInMB ObjectsReadFromDisk4000K RemoteObjectMisses"}
Make sure the mbean variable, $mbean, is defined before issuing the preceding comman.
Use Jython: objNameString = AdminControl.completeObjectName('WebSphere:type=Server,*') print AdminControl.invoke(objNameString, 'stop')
objNameString = AdminControl.completeObjectName("WebSpheretype=DynaCache,*") AdminControl.invoke(dc, "getCacheStatistics", '["DiskCacheSizeInMB ObjectReadFromDisk4000K RemoteObjectMisses"]')
Use Jython list: objNameString = AdminControl.completeObjectName("WebSphere:type=DynaCache,*") AdminControl.invoke(dc, "getCacheStatistics", [["DiskCacheSizeInMB", "ObjectReadFromDisk4000K", "RemoteObjectMisses"]])
invoke_jmx
Invoke the object operation by conforming the parameter list to the signature. The command returns the result of the invocation.
Target object: None.
Required parameters:
- object name
- Object name of the MBean of interest. (ObjectName)
- operation
- Operation to invoke. (java.lang.String)
Optional parameters:
- arguments
- Arguments required for the operation. If no arguments are required for the operation of interest, we can omit the arguments parameter. (java.lang.String[] or java.lang.Object[])
Sample output
The command returns a string that shows the result of the invocation.
Examples
- Use Jacl:
set objNameString [$AdminControl completeObjectName WebSphere:type=TraceService,*] set objName [java::new javax.management.ObjectName $objNameString] set parms [java::new {java.lang.Object[]} 1 com.ibm.ejs.sm.*=all=disabled] set signature [java::new {java.lang.String[]} 1 java.lang.String] $AdminControl invoke_jmx $objName $parms $signature
Use Jython: objNameString = AdminControl.completeObjectName('WebSphere:type=TraceService,*') import javax.management as mgmt objName = mgmt.ObjectName(objNameString) parms = ['com.ibm.ejs.sm.*=all=disabled'] signature = ['java.lang.String'] print AdminControl.invoke_jmx(objName, parms, signature)
isRegistered
Determine if a specific object name is registered.
Target object: None.
Required parameters:
- object name
- Object name of interest. (java.lang.String)
Optional parameters: None.
Sample output
The command returns a boolean value for the object of interest. If the ObjectName value is registered in the server, then the value is 1:
wsadmin>s = AdminControl.queryNames( 'type=Server,*' ).splitlines()[ 0 ] wsadmin>AdminControl.isRegistered( s ) 1 wsadmin>
If the ObjectName value is not registered in the server, then the value is 0.
Examples
- Use Jacl:
set objNameString [$AdminControl completeObjectName WebSphere:type=Server,*] $AdminControl isRegistered $objNameString
Use Jython: objNameString = AdminControl.completeObjectName('WebSphere:type=Server,*') print AdminControl.isRegistered(objNameString)
isRegistered_jmx
Determine if a specific object name is registered.
Target object: None.
Required parameters:
- object name
- Object name of interest. (java.lang.String)
Optional parameters: None.
Sample output
The command returns a boolean value for the object of interest. If the ObjectName value is registered in the server, then the value is true:
true
Examples
- Use Jacl:
set objectNameString [$AdminControl completeObjectName type=Server,*] set objName [$AdminControl makeObjectName $objNameString] $AdminControl isRegistered_jmx $objName
Use Jython: objectNameString = AdminControl.completeObjectName('type=Server,*') objName = AdminControl.makeObjectName(objectNameString) print AdminControl.isRegistered_jmx(objName)
makeObjectName
Create an ObjectName value based on the strings input. This command does not communicate with the server, so the ObjectName value that results might not exist. If the string you supply contains an extra set of double quotes, they are removed. If the string does not begin with a Java Management Extensions (JMX) domain, or a string followed by a colon, then the WebSphere Application Server string appends to the name.
Target object: None.
Required parameters:
- object name
- Object name of interest. (java.lang.String)
Optional parameters: None.
Sample output
The command returns an Objectname object constructed from the object name string.
Examples
- Use Jacl:
set objectNameString [$AdminControl completeObjectName type=Server,node=mynode,*] set objName [$AdminControl makeObjectName $objNameString]
Use Jython: objectNameString = AdminControl.completeObjectName('type=Server,node=mynode,*') objName = AdminControl.makeObjectName(objectNameString)
queryMBeans
Query for a list of object instances that match the object name that we provide.
Target object: None.
Required parameters:
- object name
- Object name of interest. (ObjectName)
Optional parameters:
- query
- The query expression. (QueryExp)
Sample output
The command returns a list of object instances for the object name specified, as the following example displays:
WebSphere:name=PlantsByWebSphere,process=server1,platform=dynamicproxy,node=Goodog, J2EEName=PlantsByWebSphere,Server=server1,version=6.1.0.0,type=Application, mbeanIdentifier=cells/GooddogNode02Cell/applications/PlantsByWebSphere.ear/ deployments/PlantsByWebSphere/deployment.xml#ApplicationDeployment_1126623343902, cell=GooddogNode02Cell
Examples
- Use Jacl:
set apps [$AdminControl queryMBeans type=Application,*]
Manipulate the return value of the queryMBeans command:
set appArray [$apps toArray] set app1 [java::cast javax.management.ObjectInstance [$appArray get 0]] puts [[$app1 getObjectName] toString]
The following example specifies the object name and the query expression:
set apps [$AdminControl queryMBeans type=Application,* [java::null]]
Manipulate the return value of the queryMBeans command:
set appArray [$apps toArray] set app1 [java::cast javax.management.ObjectInstance [$appArray get 0]] puts [[$app1 getObjectName] toString]
Use Jython: apps = AdminControl.queryMBeans('type=Application,*')
Manipulate the return value of the queryMBeans command:
appArray = apps.toArray() app1 = appArray[0] print app1.getObjectName().toString()
The following example specifies the object name and the query expression:
apps = AdminControl.queryMBeans('type=Application,*',None)Manipulate the return value of the queryMBeans command:
appArray = apps.toArray() app1 = appArray[0] print app1.getObjectName().toString()
queryNames
Query for a list of each of the ObjectName objects based on the name template.
Target object: None.
Required parameters:
- object name
- Object name of interest. We can specify a wildcard for the object name parameter with the asterisk character (*). (java.lang.String)
Optional parameters: None.
Sample output
The command returns a string containing the ObjectNames that match the input object name, as the following example displays:
WebSphere:cell=BaseApplicationServerCell, name=server1,mbeanIdentifier=server1, type=Server,node=mynode,process=server1
Examples
- Use Jacl:
$AdminControl queryNames WebSphere:type=Server,*
Use Jython: print AdminControl.queryNames('WebSphere:type=Server,*')
queryNames_jmx
Query for a list of each of the ObjectName objects based on the name template and the query conditions specified.
Target object: None.
Required parameters:
- object name
- Object name of interest. We can specify a wildcard for the object name parameter with the asterisk character (*). (ObjectName)
- query
- The query expression to use. (javax.management.QueryExp)
Optional parameters: None.
Sample output
The command returns a string containing the ObjectNames that match the input object name, as the following example displays:
[WebSphere:cell=BaseApplicationServerCell,name=server1,mbeanIdentifier= server1,type=Server,node=mynode,process=server1]
Examples
- Use Jacl:
set objectNameString [$AdminControl completeObjectName type=Server,*] set objName [$AdminControl makeObjectName $objNameString] set null [java::null] $AdminControl queryNames_jmx $objName $null
Use Jython: objectNameString = AdminControl.completeObjectName('type=Server,*') objName = AdminControl.makeObjectName(objectNameString) print AdminControl.queryNames_jmx(objName, None)
reconnect
Reconnect to the server, and to clear information out of the local cache.
Target object: None.
Required parameters: None.
Optional parameters: None.
Sample output
The command returns a message that displays the status of the operation:
WASX7074I: Reconnect of SOAP connector to host myhost completed.
Examples
- Use Jacl:
$AdminControl reconnect
Use Jython: print AdminControl.reconnect()
setAttribute
Set the attribute value for the name that we provide.
Target object: None.
Required parameters:
- object name
- Object name of the MBean of interest. (java.lang.String)
- attribute name
- Name of the attribute to set. (java.lang.String)
- attribute value
- Value of the attribute of interest. (java.lang.String)
Optional parameters: None.
Sample output
The command returns does not return output.
Examples
- Use Jacl:
set objNameString [$AdminControl completeObjectName WebSphere:type=TraceService,*] $AdminControl setAttribute $objNameString traceSpecification com.ibm.*=all=disabled
Use Jython: objNameString = AdminControl.completeObjectName('WebSphere:type=TraceService,*') print AdminControl.setAttribute(objNameString, 'traceSpecification', 'com.ibm.*=all=disabled')
setAttribute_jmx
Set the attribute value for the name that we provide.
Target object: None.
Required parameters:
- object name
- Object name of the MBean of interest. (ObjectName)
- attribute
- Name of the attribute to set. (Attribute)
Optional parameters: None.
Sample output
The command returns does not return output.
Examples
- Use Jacl:
set objectNameString [$AdminControl completeObjectName WebSphere:type=TraceService,*] set objName [$AdminControl makeObjectName $objectNameString] set attr [java::new javax.management.Attribute traceSpecification com.ibm.*=all=disabled] $AdminControl setAttribute_jmx $objName $attr
Use Jython: objectNameString = AdminControl.completeObjectName('WebSphere:type=TraceService,*') import javax.management as mgmt objName = AdminControl.makeObjectName(objectNameString) attr = mgmt.Attribute('traceSpecification', 'com.ibm.*=all=disabled') print AdminControl.setAttribute_jmx(objName, attr)
setAttributes
Set the attribute values for the object names provided.
Target object: None.
Required parameters:
- object name
- Object name of the MBean of interest. (String)
- attributes
- Names of the attributes to set. (java.lang.String[] or java.lang.Object[])
Optional parameters: None.
Sample output
The command returns a list of object names that are successfully set by the command invocation, as the following example displays:
'[traceSpecification com.ibm.ws.*=all=enabled]'
Examples
- Use Jacl:
set objNameString [$AdminControl completeObjectName WebSphere:type=TraceService,*] $AdminControl setAttributes $objNameString {{traceSpecification com.ibm.ws.*=all=enabled}}
Use Jython with string attributes: objNameString = AdminControl.completeObjectName('WebSphere:type=TraceService,*') AdminControl.setAttributes(objNameString, '[[traceSpecification "com.ibm.ws.*=all=enabled"]]')
Use Jython with object attributes: objNameString = AdminControl.completeObjectName('WebSphere:type=TraceService,*') print AdminControl.setAttributes(objNameString, [['traceSpecification', 'com.ibm.ws.*=all=enabled']])
setAttributes_jmx
Set the attribute values for the object names provided.
Target object: None.
Required parameters:
- object name
- Object name of the MBean of interest. (String)
- attributes
- Names of the attributes to set. (javax.management.AttributeList)
Optional parameters: None.
Sample output
The command returns an attribute list of object names that are successfully set by the command invocation:
'[traceSpecification com.ibm.ws.*=all=enabled]'
Examples
- Use Jacl:
set objectNameString [$AdminControl completeObjectName WebSphere:type=TraceService,*] set objName [$AdminControl makeObjectName $objectNameString] set attr [java::new javax.management.Attribute traceSpecification com.ibm.ws.*=all=enabled] set alist [java::new javax.management.AttributeList] $alist add $attr $AdminControl setAttributes_jmx $objName $alist
Use Jython: objectNameString = AdminControl.completeObjectName('WebSphere:type=TraceService,*') import javax.management as mgmt objName = AdminControl.makeObjectName(objectNameString) attr = mgmt.Attribute('traceSpecification', 'com.ibm.ws.*=all=enabled') alist = mgmt.AttributeList() alist.add(attr) print AdminControl.setAttributes_jmx(objName, alist)
startServer
Start the specified application server by locating it in the configuration. This command uses the default wait time. To determine which parameters to use:
- If the scripting process is attached to a node agent server, we must specify the server name. We can also specify the optional wait time and node name parameters.
- If the scripting process is attached to a dmgr process, specify the server name and node name. We can also specify the optional wait time parameter.
Target object: None.
Required parameters:
- server name
- Name of the server to start. (java.lang.String)
Optional parameters:
- node name
- Name of the node of interest. (java.lang.String)
- wait time
- Number of seconds that the start process waits for the server to start. The default wait time is 1200 seconds. (java.lang.String)
Sample output
Server launched. Waiting for initialization status. Server server1 open for e-business; process id is 1932.
Examples
Use Jacl:
- The following example specifies only the name of the server to start:
$AdminControl startServer server1
The following example specifies the name of the server to start and the wait time: $AdminControl startServer server1 100
The following example specifies the name of the server to start and the name of the node: $AdminControl startServer server1 myNode
The following example specifies the name of the server, the name of the node, and the wait time: $AdminControl startServer server1 myNode 100
Use Jython:
- The following example specifies only the name of the server to start:
AdminControl.startServer('server1')
The following example specifies the name of the server to start and the wait time: AdminControl.startServer('server1', 100)
The following example specifies the name of the server to start and the name of the node: AdminControl.startServer('server1', 'myNode')
The following example specifies the name of the server, the name of the node, and the wait time: AdminControl.startServer('server1', 'myNode', 100)
stopServer
Stop the specified application server. When the stopServer command runs without the immediate or terminate flags, the server finishes any work in progress, but does not accept any new work once it begins the stop process. Use the following options to determine which parameters to use:
- Use the server name and the node name parameters to stop a server in a specific node.
- Use the server name and immediate flag parameters to stop the server immediately. If not specified, the system stops the server normally.
- Use the server name, node name, and immediate flag parameters to immediately stop a server for a specific node.
An error message is issued if only specify the server name when we attempt to stop that server.
Target object: None.
Required parameters:
- server name
- Name of the server to start. (java.lang.String)
Optional parameters:
- node name
- Name of the node of interest. (java.lang.String)
- immediate flag
- To stop the server immediately if the value is set to immediate. If we specify the immediate flag, the server does not finish processing any work in progress, does not accept any new work, and ends the server process. (java.lang.String)
- terminate flag
- That the server process should be terminated by the operating system. (String)
Sample output
The command returns a message to indicate if the server stops successfully, as the following example displays:
WASX7337I: Invoked stop for server "server1" Waiting for stop completion. 'WASX7264I: Stop completed for server "server1" on node "myNode"'
Examples
Use Jacl:
- The following example specifies only the name of the server to stop:
$AdminControl stopServer server1
The following example specifies the name of the server to stop and indicates that the server should stop immediately: $AdminControl stopServer server1 immediate
The following example specifies the name of the server to stop and the name of the node: $AdminControl stopServer server1 myNode
The following example specifies the name of the server, the name of the node, and indicates that the server should stop immediately: $AdminControl stopServer server1 myNode immediate
Use Jython:
- The following example specifies the name of the server to stop and indicates that the server should stop immediately:
AdminControl.stopServer('server1','immediate')
The following example specifies the name of the server to stop and the name of the node: AdminControl.stopServer('server1','myNode')
The following example specifies the name of the server, the name of the node, and indicates that the server should stop immediately: AdminControl.stopServer('server1','myNode','immediate')
testConnection
Test a data source connection. This command works with the data source that resides in the configuration repository. If the data source to be tested is in the temporary workspace that holds the update to the repository, we must save the update to the configuration repository before running this command. Use this command with the configuration ID that corresponds to the data source and the WAS40DataSource object types.
Target object: None.
Required parameters:
- configuration ID
- Configuration ID of the data source object of interest. (java.lang.String)
Optional parameters: None.
Sample output
The command returns a message that indicates a successful connection or a connection with a warning. If the connection fails, an exception is created from the server indicating the error. For example:
WASX7217I: Connection to provided datasource was successful.
Examples
- Use Jacl:
set ds [lindex [$AdminConfig list DataSource] 0] $AdminControl testConnection $ds
Use Jython: # get line separator import java.lang.System as sys lineSeparator = sys.getProperty('line.separator') ds = AdminConfig.list('DataSource').split(lineSeparator)[0] print AdminControl.testConnection(ds)
trace
Set the trace specification for the scripting process to the value specified.
Target object: None.
Required parameters:
- trace specification
- Trace to enable for the scripting process. (java.lang.String)
Optional parameters: None.
Sample output
The command does not return output.
Examples
- Use Jacl:
$AdminControl trace com.ibm.ws.scripting.*=all=enabled
Use Jython: print AdminControl.trace('com.ibm.ws.scripting.*=all=enabled')
wsadmin AdminControl