+

Search Tips   |   Advanced Search

Set EJB containers using scripting


Use the AdminConfig object or the wsadmin script library to configure EJB containers in the configuration.

There are two ways to perform this task. Complete the steps in this topic to use the AdminConfig object to modify the EJB container configuration. Alternatively, we 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 configureEJBContainer script:

AdminServerManagement.configureEJBContainer(nodeName, serverName, ejbName, passivationDir, defaultDatasourceJNDIName)

For additional information and argument definitions, see the documentation for the AdminServerManagement script library.

Launch wsadmin.

 

Code

### get_EJB.jacl
###
###

### Identify the appserver of interest. 

### Jacl... 
set serv1 [$AdminConfig getid /Cell:mycell/Node:mynode/Server:server1/]

### Jython...
#serv1 = AdminConfig.getid('/Cell:mycell/Node:mynode/Server:server1/')
#print serv1

### Example output
###
### server1(cells/mycell/nodes/mynode/servers/server1|server.xml#Server_1)



### Identify the EJB container that belongs to the server. 

### Jacl...
set ejbc1 [$AdminConfig list EJBContainer $serv1]

### Jython...
#ejbc1 = AdminConfig.list('EJBContainer', serv1)
#print ejbc1


### For EJBContainer the name specified is based on the XML configuration files 
### and does not have to be the same name that the admin console displays.


### Example output  
### 
### (cells/mycell/nodes/mynode/servers/server1|server.xml#EJBContainer_1)



### View each of the attributes of the EJB container. 
### Does not display nested attribute


### 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)}





### 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)]
###

### Display the EJB container attributes, including nested attributes:


### 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)}}}


### 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)]]]



### Modify the attributes. 

### Jacl...
$AdminConfig modify $ejbc1 {{cacheSettings {{cacheSize 2500} {cleanupInterval 3500}}}} 


### Jython...
#AdminConfig.modify(ejbc1, [['cacheSettings', [['cacheSize', 2500],  ['cleanupInterval', 3500]]]])


### Modify the cleanup interval attribute: 

### Jacl...
$AdminConfig modify $ejbc1 {{inactivePoolCleanupInterval 15000}}

### Jython...
#AdminConfig.modify(ejbc1, [['inactivePoolCleanupInterval', 15000]])


### Save the changes AdminConfig.save()

 

Related tasks


EJB containers
Manage EJB containers
Modify nested attributes with wsadmin
Set servers with scripting

 

Related

Commands for the AdminConfig object
Server settings configuration scripts