Configuring EJB containers using wsadmin
You can use the AdminConfig object or the wsadmin script library to configure Enterprise JavaBeans (EJB) containers in your configuration.
About this task
There are two ways to perform this task. Complete the steps in this topic to use the AdminConfig object to modify your EJB container configuration. Alternatively, you can use the configureEJBContainer Jython script in the AdminServerManagement script library to configure EJB containers. The wsadmin tool automatically loads the script when the tool starts. Use the following syntax to configure EJB containers using the configureEJBContainer script:
AdminServerManagement.configureEJBContainer(nodeName, serverName, ejbName, passivationDir,
defaultDatasourceJNDIName)
For additional information and argument definitions, see the documentation for the AdminServerManagement script library.
Procedure
- 啟動 wsadmin Scripting 工具。
- Identify the application server of interest. The following examples identify the application server and assign it to the serv1 variable:
Using Jacl:
set serv1 [$AdminConfig getid /Cell:mycell/Node:mynode/Server:server1/]
Using Jython:
serv1 = AdminConfig.getid('/Cell:mycell/Node:mynode/Server:server1/') print serv1
Table 1. Command elements. The following table explains elements in the Jacl and Jython examples: Element Description set Jacl command serv1 Variable name $ Jacl operator for substituting a variable name with its value AdminConfig Object representing the application server configuration getid AdminConfig command /Cell:mycell/Node:mynode/Server:server1/ The 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 that belongs to the server.
The following example identifies the EJB container for the server of interest and assigns it to the ejbc1 variable:
Using Jacl:
set ejbc1 [$AdminConfig list EJBContainer $serv1]
Using Jython:
ejbc1 = AdminConfig.list('EJBContainer', serv1) print ejbc1
The previous commands consist of the following elements:
Table 2. Command elements. The following table explains elements in the Jacl and Jython examples: Element Description set Jacl command ejbc1 Variable name $ Jacl operator for substituting a variable name with its value AdminConfig The object that represents the application server configuration list AdminConfig command EJBContainer The object type The name of the object type that you specify is the one based on the XML configuration files and does not have to be the same name that the administrative console displays.
serv1 Evaluates to the ID of the server of interest Example output:(cells/mycell/nodes/mynode/servers/server1|server.xml#EJBContainer_1)
- View each of the attributes of the EJB container. The following example displays the EJB container attributes but does not display nested attributes:
Using Jacl:
$AdminConfig show $ejbc1
Example 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)}
Using Jython:
print AdminConfig.show(ejbc1)
Example output:The previous commands consist of the following elements:[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)]
Table 3. Command elements. The following table explains elements in the Jacl and Jython examples: Element Description $ Jacl operator for substituting a variable name with its value print Jython command AdminConfig The object that represents the application server configuration showall AdminConfig command ejbc1 evaluates to the ID of the enterprise bean container
The following example displays the EJB container attributes, including nested attributes:Using Jacl:
$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)}}}
Using Jython:
print AdminConfig.showall(ejbc1)
Example output:The previous commands consist of the following elements:[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)]]]
Table 4. Command elements. The following table explains elements in the Jacl and Jython examples: Element Description $ Jacl operator for substituting a variable name with its value print Jython command AdminConfig The object that represents the application server configuration showall AdminConfig command ejbc1 evaluates to the ID of the enterprise bean container
- Modify the attributes.
The following example modifies the enterprise bean cache settings and it includes nested attributes:
Using Jacl:
$AdminConfig modify $ejbc1 {{cacheSettings {{cacheSize 2500} {cleanupInterval 3500}}}}
Using Jython:
AdminConfig.modify(ejbc1, [['cacheSettings', [['cacheSize', 2500], ['cleanupInterval', 3500]]]])
The previous commands consist of the following elements:
Table 5. Command elements. The following table explains elements in the Jacl and Jython examples: Element Description $ Jacl operator for substituting a variable name with its value AdminConfig The object that represents the application server configuration modify AdminConfig command ejbc1 Evaluates to the ID of the enterprise bean container cacheSettings The attribute of modify objects cacheSize The attribute of modify objects 2500 The value of the cacheSize attribute cleanupInterval The attribute of modify objects 3500 The value of the cleanupInterval attribute
The following example modifies the cleanup interval attribute:
Using Jacl:
$AdminConfig modify $ejbc1 {{inactivePoolCleanupInterval 15000}}
Using Jython:
AdminConfig.modify(ejbc1, [['inactivePoolCleanupInterval', 15000]])
The previous commands consist of the following elements:
Table 6. Command elements. The following table explains elements in the Jacl and Jython examples: Element Description $ Jacl operator for substituting a variable name with its value AdminConfig The object that represents the application server configuration modify AdminConfig command ejbc1 Evaluates to the ID of the enterprise bean container inactivePoolCleanupInterval The attribute of modify objects 15000 The value of the inactivePoolCleanupInterval attribute
- Save the changes. 請利用下列指令範例來儲存您的配置變更:
AdminConfig.save()


http://www14.software.ibm.com/webapp/wsbroker/redirect?version=cord&product=was-nd-mp&topic=txml_configejb
檔名:txml_configejb.html