Useful WLST Scripts – Managing composite state using command line WLST

Useful WLST Scripts – Managing composite state using command line WLST

We have created a list of Useful WLST commands for SOA covering how we can use the WLST commands to retire/shutdown/start/activate/deploy/undeploy a composite.

Use the scripts located at:

(UNIX) MIDDLEWARE_HOME/ORACLE_SOA1/common/bin/wlst.sh

(Windows) C:oracleMiddleware11116Oracle_SOA1commonbinwlst.cmd

Note: Do not use the WLST script in the WebLogic Server home.  

In case you use the WLS tool from  MIDDLEWARE_HOMEoracle_commoncommonbin Or  from MIDDLEWARE_HOME wlserver_10.3commonbin   It will throw following error.   Traceback (innermost last):   File “”, 1,=”” ?<=”” in=”” line=”” span=””>”,> NameError: sca_undeployComposite
 
[user1@servername bin]$ pwd
/u01/app/oracle/mysoa/product/fmw/Oracle_SOA1/common/bin
[user1@servername bin]$./wlst.sh

Initializing WebLogic Scripting Tool (WLST) …

Welcome to WebLogic Server Administration Scripting Shell

Type help() for help on available commands

Connect to WLST

wls:/offline> connect(‘weblogic’,’weblogicpassword’,’servername:port’)
Connecting to t3://servername:port with userid weblogic …
Successfully connected to managed Server ‘WLS_SOA1’ that belongs to domain ‘soa_domain’.

Note:
Make sure to connect to SOA server or cluster. If you have a clustered environment, then use SOA cluster/managed server host & port in the connection information. Otherwise you can expect below error:-

Connecting to: service:jmx:t3://servername:port/jndi/weblogic.management.mbeanservers.runtime
Cannot find composite lifecycle mbean.
wls:/soa_domain/serverConfig>

Retiring a Composite

wls:/soa_domain/serverConfig> sca_retireComposite(“nysolutionsltd.com”,”8400″,”weblogic”,”weblogicpassword”,”CompositeName”,”1.01″,partition=”SOA_Partition”)
host = nysolutionsltd.com
port = 8400
user = weblogic
partition = SOA_Partition
compositeName = CompositeName
revision = 0.01
label =  None
compositeDN =SOA_Partition/CompositeName!0.01
Connecting to: service:jmx:t3://nysolutionsltd.com:8400/jndi/weblogic.management.mbeanservers.runtime
Composite (SOA_Partition/CompositeName!0.01) is successfully retired.

Stop/Shutdown a composite

wls:/soa_domain/serverConfig> sca_stopComposite(“soa.nysolutionsltd.com”,”8400″,”weblogic”,”mypassword”,”MYCompositeName”,”0.01″,partition=”SOA_Partition”)
host = soa.nysolutionsltd.com
port = 8400
user = weblogic
partition = SOA_Partition
compositeName = MYCompositeName
revision = 0.01
label =  None
compositeDN =SOA_Partition/MYCompositeName!0.01
Connecting to: service:jmx:t3://soa.nysolutionsltd.com:8400/jndi/weblogic.management.mbeanservers.runtime
Composite (SOA_Partition/MYCompositeName!0.01) is successfully stopped.
wls:/soa_domain/serverConfig>

Starting a composite

wls:/soa_domain/serverConfig> sca_startComposite(“soa.nysolutionsltd.com”,”8400″,”weblogic”,”mypassword”,”MYCompositeName”,”0.01″,partition=”SOA_Partition”)
host = soa.nysolutionsltd.com
port = 8400
user = weblogic
partition = SOA_Partition
compositeName = MYCompositeName
revision = 0.01
label =  None
compositeDN =SOA_Partition/MYCompositeName!0.01
Connecting to: service:jmx:t3://soa.nysolutionsltd.com:8400/jndi/weblogic.management.mbeanservers.runtime
Composite (SOA_Partition/MYCompositeName!0.01) is successfully started..

Activating a Composite

wls:/soa_domain/serverConfig> sca_activateComposite(“soa.nysolutionsltd.com”,”8400″,”weblogic”,”mypassword”,”MYCompositeName”,”0.01″,partition=”SOA_Partition”)
host = soa.nysolutionsltd.com
port = 8400
user = weblogic
partition = SOA_Partition
compositeName = MYCompositeName
revision = 0.01
label =  None
compositeDN =SOA_Partition/MYCompositeName!0.01
Connecting to: service:jmx:t3://soa.nysolutionsltd.com:8400/jndi/weblogic.management.mbeanservers.runtime
Composite (SOA_Partition/MYCompositeName!0.01) is successfully activated.

List all Composites

wls:/soa_domain/serverConfig> sca_listDeployedComposites(‘soa.nysolutionsltd.com’,’8400′,’weblogic’,’mypassword’)
host = soa.nysolutionsltd.com
port = 8400
user = weblogic
Connecting to: service:jmx:t3://soa.nysolutionsltd.com:8400/jndi/weblogic.management.mbeanservers.runtime

Following 102 composites are currently deployed to the platform:

1. MYCompositeNameABCS[1.04], partition=SOA_Partition, mode=retired, state=off, isDefault=false, deployedTime=2012-04-25T15:51:19.116+01:00
2. MYCompositeNameABCS[1.05], partition=SOA_Partition, mode=active, state=on, isDefault=true, deployedTime=2012-05-21T09:51:34.818+01:00
.
.
.
.
101. MYCompositeNameProvABCS[4.0.0], partition= SOA_Partition, mode=active, state=on, isDefault=true, deployedTime=2012-05-21T17:11:12.104+01:00
102. MYCompositeNameProvABCS[4.0.0], partition= SOA_Partition, mode=active, state=on, isDefault=true, deployedTime=2012-05-21T17:11:44.603+01:00

6) Deploying and Undeploying

Same way a composite can be deployed or undeployed using WLST Commands.More on those on the links mentioned in references section.
References:

Another useful post from Danilo Schmiedel on undeploying using ant @ http://inside-bpm-and-soa.blogspot.co.uk/2012/11/undeploy-multiple-soa-composites-with.html
http://docs.oracle.com/cd/E15586_01/web.1111/e13813/custom_soa.htm#CDEEEIAA
http://docs.oracle.com/cd/E15586_01/core.1111/e10105/getstart.htm#ASADM10692

http://docs.oracle.com/cd/E21764_01/web.1111/e13715.pdf

2 Responses so far.

  1. Nice Nitin good reference …
    we have tried with some more programming logic inside the script which will much flexibility …

    http://wlstbyexamples.blogspot.in/2013/06/soa-retire-activate-composites.htm

  2. Very useful summary of WLST scripts! Nice!