Example: Disabling a component using wsadmin
An example of disabling the name server component of a configured server follows. You can modify this example to disable a different component.
- Identify the server and assign it to the server variable.
Using Jacl:
set server [$AdminConfig getid /Cell:mycell/Node:mynode/Server:server1/]
Using Jython:
server = AdminConfig.getid('/Cell:mycell/Node:mynode/Server:server1/') print server
Example output:
server1(cells/mycell/nodes/mynode/servers/server1:server.xml#Server_1)
- List the components belonging to the server and assign them to the components variable.
Using Jacl:
set components [$AdminConfig list Component $server]
Using Jython:
components = AdminConfig.list('Component', server) print components
The components variable contains a list of components.
Example
output:
(cells/mycell/nodes/mynode/servers/server1:server.xml#ApplicationServer_1) (cells/mycell/nodes/mynode/servers/server1:server.xml#EJBContainer_1) (cells/mycell/nodes/mynode/servers/server1:server.xml#NameServer_1) (cells/mycell/nodes/mynode/servers/server1:server.xml#WebContainer_1)
- Identify the name server component and assign it to the nameServer variable.
Since the name server component is the third element in the list, retrieve this element by using index 2.
Using Jacl:
set nameServer [lindex $components 2]
Using Jython:
# get line separator import java lineSeparator = java.lang.System.getProperty('line.separator') arrayComponents = components.split(lineSeparator) nameServer = arrayComponents[2] print nameServer
Example output:
(cells/mycell/nodes/mynode/servers/server1:server.xml#NameServer_1)
- Disable the name server component by changing the nested initialState attribute belonging to the stateManagement attribute.
Using Jacl:
$AdminConfig modify $nameServer {{stateManagement {{initialState STOP}}}}
Using Jython:
AdminConfig.modify(nameServer, [['stateManagement', [['initialState', 'STOP']]]])
- Save the changes with the following command:
Using Jacl:
$AdminConfig save
Using Jython:
AdminConfig.save()