Basically we must obtain a list of sca_ resources deployed in our servers, some of them are clusters, although some use different IP/Ports the tool keeps the same.
The main document can be found here in the Oracle webiste. Basically, there are two main functions to achieve this task:
- sca_listDeployedComposites()
- sca_listCompositesInPartition()
In order to use them you must use the weblogic scripting tool from the Oracle home:
- <MIDDLEWARE_HOME>/soa/common/bin/wlst.sh
If you use the wlst.sh from Weblogic, OSB or oracle_common you’ll receive the next error:
wls:/offline> sca_listCompositesInPartition Traceback (innermost last): File "<console>", line 1, in ? NameError: sca_listCompositesInPartition
Just because this custom functions are not available on those installations.
If you have a cluster, use the IP/PORT of one of your managed servers otherwise you’ll receive the error:
wls:/soa_domain/serverConfig> sca_listDeployedComposites('<HOSTNAME>','<PORT>','<USERNAME>','<PASSWORD>') host = <HOSTNAME> port = <PORT> user = <USERNAME> partition = My_partition Connecting to JMX Server at host: <HOSTNAME> port <PORT> Exception:java.io.IOException
Or this error:
wls:/soa_domain/serverConfig> Cannot find composite lifecycle mbean.
Usage: you should connect to your domain and execute the function like this:
<MIDDLEWARE_HOME>/soa/common/bin/wlst.sh wls:/offline> connect('<USERNAME>','<PASSWORD>','<T3://IP/PORT>') sca_listDeployedComposites('<HOSTNAME_OR_IP>','<PORT>','<USER>','<PASSWORD>') #or list all by partition: sca_listDeployedComposites('<HOSTNAME_OR_IP','<PORT>','<USER>','<PASSWORD>')
I’ve written an script to perform the task in different domains. The script must be run in this way:
<MIDDLEWARE_HOME>/soa/common/bin/wlst.sh bring_composites.py <ENV> <DOMAIN>
# miguel.ortiz # List SOA Composites import sys,os,re environment = sys.argv[1] domain = sys.argv[2] hostUser = 'READONLY_USER' hostPass = 'read_only_pass' # you need to provide two parameters, environment and domain if environment == '' or domain == '' : print 'este script requiere (2) parametros, Ambiente y Dominio' # if the environment is QAM if environment == 'QAM' : hostIP = '172.x.x.x' if domain == 'SYNC': hostPort = '8001' if domain == 'ASYNC': hostPort = '8002' if domain == 'RSYNC': hostPort = '8003' # If my environment is Production if environment == 'PROD' : hostIP = '172.x.x.x' if domain == 'SYNC': hostPort = '8001' if domain == 'ASYNC': hostPort = '8002' if domain == 'RSYNC': hostPort = '8003' # Connect to the host connect( hostUser , hostPass , 't3://' + hostIP + ':' + hostPort ) # Redirect the standard output to get a clear result old_stdout = sys.stdout sys.stdout = open('file', 'w') sca_listDeployedComposites( hostIP , hostPort , hostUser , hostPass) sys.stdout = old_stdout file = open('file', 'r') # parse the file to get only the composites and versions for line in file : if re.match(r'^[0-9]', line) : line = line.replace('partition=','') line = line.replace(',','') line = line.split(' ') new = line[1:3] print new else: pass