Configure enterprise bean containers using scripting
You can configure enterprise bean containers using scripting and the wsadmin tool. Before starting this task, the wsadmin tool must be running. See Start the wsadmin scripting client for more information.
Overview
Perform the following steps to configure an enterprise bean container:
Procedure
- Identify the appserver and assign it to the serv1 variable. For example:
Use Jacl:
set serv1 [$AdminConfig getid /Cell:mycell/Node:mynode/Server:server1/]
- Use Jython:
serv1 = AdminConfig.getid('/Cell:mycell/Node:mynode/Server:server1/') print serv1where:
set Jacl command serv1 variable name $ Jacl operator for substituting a variable name with its value AdminConfig object representing the WebSphere Application Server configuration getid AdminConfig command /Cell:mycell/Node:mynode/Server:server1/ hierarchical containment path of the configuration object Cell object type mycell optional name of the object Node object type mynode optional name of the object Server object type server1 optional name of the object Example output:
server1(cells/mycell/nodes/mynode/servers/server1|server.xml#Server_1)
- Identify the EJB container belonging to the server and assign it to the ejbc1 variable. For example:
Use Jacl:
set ejbc1 [$AdminConfig list EJBContainer $serv1]
- Use Jython:
ejbc1 = AdminConfig.list('EJBContainer', serv1) print ejbc1where:
set Jacl command ejbc1 variable name $ Jacl operator for substituting a variable name with its value AdminConfig object representing the WebSphere Application Server configuration list AdminConfig command EJBContainer object type The name of the object type that you input here is the one based on the XML configuration files and does not have to be the same name that the console displays.
serv1 evaluates to the ID of the server specified in step number 1 Example output:
(cells/mycell/nodes/mynode/servers/server1|server.xml#EJBContainer_1)
- View all the attributes of the enterprise bean container.
- The following example command does not show nested attributes:
Use Jacl:
$AdminConfig show $ejbc1Example output:{cacheSettings (cells/mycell/nodes/mynode/servers/ server1|server.xml#EJBCache_1)} {components {}} {inactivePoolCleanupInterval 30000} {parentComponent (cells/mycell/nodes/mynode/servers/ server1|server.xml#ApplicationServer_1) {passivationDirectory ${USER_INSTALL_ROOT}/temp} {properties {}} {services {(cells/mycell/nodes/mynode/servers/ server1|server.xml#MessageListenerService_1)} {stateManagement (cells/mycell/nodes/mynode/servers/ server1|server.xml#StateManageable_10)}
- Use Jython:
print AdminConfig.show(ejbc1)Example output:[cacheSettings (cells/mycell/nodes/myode/servers/ server1|server.xml#EJBCache_1)] [components []] [inactivePoolCleanupInterval 30000] [parentComponent (cells/mycell/nodes/myode/servers/ server1|server.xml#ApplicationServer_1) [passivationDirectory ${USER_INSTALL_ROOT}/temp] [properties []] [services [(cells/mycell/nodes/myode/servers/ server1|server.xml#MessageListenerService_1)] [stateManagement (cells/mycell/nodes/mynode/servers/ server1|server.xml#StateManageable_10)]where:
$ Jacl operator for substituting a variable name with its value Jython command AdminConfig object representing the WebSphere Application Server configuration showall AdminConfig command ejbc1 evaluates to the ID of the enterprise bean container specified in step number 2
- The following command example includes nested attributes:
Use Jacl:
$AdminConfig showall $ejbc1Example output:{cacheSettings {{cacheSize 2053} {cleanupInterval 3000}}} {components {}} {inactivePoolCleanupInterval 30000} {parentComponent (cells/mycell/nodes/mynode/servers/ server1|server.xml#ApplicationServer_1)} {passivationDirectory ${USER_INSTALL_ROOT}/temp} {properties {}} {services {{{context (cells/mycell/nodes/mynode/servers/ server1|server.xml#EJBContainer_1)} {listenerPorts {}} {properties {}} {threadPool {{inactivityTimeout 3500} {isGrowable false} {maximumSize 50} {minimumSize 10}}}}}} {stateManagement {{initialState START} {managedObject (cells/mycell/nodes/mynode/servers/ server1|server.xml#EJBContainer_1)}}}
- Use Jython:
print AdminConfig.showall(ejbc1)Example output:[cacheSettings [[cacheSize 2053] [cleanupInterval 3000]]] [components []] [inactivePoolCleanupInterval 30000] [parentComponent (cells/mycell/nodes/mynode/servers/ server1|server.xml#ApplicationServer_1)] [passivationDirectory ${USER_INSTALL_ROOT}/temp] [properties []] [services [[[context (cells/mycell/nodes/mynode/servers/ server1|server.xml#EJBContainer_1)] [listenerPorts []] [properties []] [threadPool [[inactivityTimeout 3500] [isGrowable false] [maximumSize 50] [minimumSize 10]]]]]] [stateManagement {{initialState START] [managedObject (cells/mycell/nodes/mynode/servers/ server1|server.xml#EJBContainer_1)]]]where:
$ Jacl operator for substituting a variable name with its value Jython command AdminConfig object representing the WebSphere Application Server configuration showall AdminConfig command ejbc1 evaluates to the ID of the enterprise bean container specified in step number 2
- Modify the attributes.
- The following example modifies the enterprise bean cache settings and it includes nested attributes:
Use Jacl:
$AdminConfig modify $ejbc1 {{cacheSettings {{cacheSize 2500} {cleanupInterval 3500}}}}
- Use Jython:
AdminConfig.modify(ejbc1, [['cacheSettings', [['cacheSize', 2500], ['cleanupInterval', 3500]]]])where:
$ Jacl operator for substituting a variable name with its value AdminConfig object representing the WebSphere Application Server configuration modify AdminConfig command ejbc1 evaluates to the ID of the enterprise bean container specified in step number 2 cacheSettings attribute of modify objects cacheSize attribute of modify objects 2500 value of the cacheSize attribute cleanupInterval attribute of modify objects 3500 value of the cleanupInterval attribute
- The following example modifies the cleanup interval attribute:
Use Jacl:
$AdminConfig modify $ejbc1 {{inactivePoolCleanupInterval 15000}}
- Use Jython:
AdminConfig.modify(ejbc1, [['inactivePoolCleanupInterval', 15000]])where:
$ Jacl operator for substituting a variable name with its value AdminConfig object representing the WebSphere Application Server configuration modify AdminConfig command ejbc1 evaluates to the ID of the enterprise bean container specified in step number 2 inactivePoolCleanupInterval attribute of modify objects 15000 value of the inactivePoolCleanupInterval attribute
- Save the changes. For example:
Use Jacl:
$AdminConfig save
- Use Jython:
AdminConfig.save()where:
$ Jacl operator for substituting a variable name with its value AdminConfig object representing the WebSphere Application Server configuration save AdminConfig command
Modifying nested attributes with the wsadmin tool
Configure servers with scripting
Related Reference
Commands for the AdminConfig object