Search This Blog

Tuesday, November 22, 2011

STD OUT/ERR REDIRECTION



Redirection
command > fileWrite standard output of command to file
command 1> fileWrite standard output of command to file (same as previous)
command 2> fileWrite standard error of command to file (OS/2 and NT)
command > file 2>&1Write both standard output and standard error of command to file (OS/2 and NT)
command >> fileAppend standard output of command to file
command 1>> fileAppend standard output of command to file (same as previous)
command 2>> fileAppend standard error of command to file (OS/2 and NT)
command >> file 2>&1Append both standard output and standard error of command to file (OS/2 and NT)
commandA | commandBRedirect standard output of commandA to standard input of commandB
commandA 2>&1 | commandBRedirect standard output and standard error of commandA to standard input of commandB (OS/2 and NT)
command < filecommand gets standard input from file
command 2>&1command's standard error is redirected to standard output (OS/2 and NT)
command 1>&2command's standard output is redirected to standard error (OS/2 and NT)


Notes:(1)Where the table mentions redirection to a file you may also use redirection to a device. Redirection from a device is not always possible.
 (2)Redirection to the NUL device is often used to hide standard output, instead of displaying it on screen:
COPY *.* A: > NUL
Another frequently used redirection is redirection to a parallel port to print standard output:
DIR > LPT1
In COMMAND.COM, if you frequently use this kind of redirection, you may find that after some time you'll get unexpected error messages complaining that there aren't enough free file handles left to acomplish some tasks and that you should increase the number of file handles, set in CONFIG.SYS (FILES=nn).
Since DOS treats devices like AUX, COMn, LPTn, NUL and PRN as files, opening a device will claim one file handle.
However, unlike files, devices will never be closed until reboot.
To make things worse, each device exists in every directory on every drive, so if you used redirection to NUL in, say, C:\ and after that you use it again in C:\TEMP, you'll lose another file handle.
There are tricks to decrease the number of file handles lost by redirection:
  • redirect to (one single temporary) file instead of NUL
  • specify a directory if you have to redirect to a device:
    DIR > %TEMP%\LPT1
    now you only claim one file handle per device, instead of one file handle per device per directory
  • use PRINT to print files:
    PRINT AUTOEXEC.BAT
    however, this will cost you some base memory, since a portion of PRINT stays resident in memory
These restrictions are not so severe in OS/2 or NT DOS sessions, since you'll probably close those sessions after executing only a few command(s), and a new DOS session will start with the full set of file handles available.
 (3)Redirections to one or more files tend to make batch files hard to read.
Sometimes the lines can be padded with spaces to align all redirection signs and make the batch file more readable.
However, if you were to do this with ECHO command lines, the spaces would really be ECHOed, which is not always convenient, to say the least.
On Marc Stern's web site I found a great solution: just place the redirections before the actual commands.
Take this imaginary batch file, for example:
ECHO Directory of all files on C: >> LOG1.LOG
DIR C:\ /S >> LOG1.LOG

Not exactly easy on the eye, that one?
How about this one, then?
>> LOG1.LOG   ECHO Directory of all files on C:
>> LOG1.LOG   DIR C:\ /S

It will do exactly the same, no difference! Much better, isn't it?
But now, try these:
VER | TIME > LOG1.LOG
> LOG1.LOG VER | TIME

As you will notice, in the second line, it is the output of VER that gets redirected to LOG1.LOG !!
As a rule of thumb: do not use this technique in command lines that also contain other redirections.
 (4)Redirecting both standard output and standard error to the same file or device is done by adding 2>&1 to the command line. This will only work in OS/2 and NT, not in MS-DOS.
Where you put 2>&1 is rather critical. It will only do what it is supposed to do when placed at the end of the command line (as Jennie Walker pointed out to me) or right before the next pipe ( | ).
 (5)When using redirection to create temporary batch files, keep in mind that the output that you redirect may vary with different language versions.
A sample of these differences is shown on the DATE/TIME page.
 (6)Sometimes we need redirection to create a temporary batch file that uses redirection itself. This may seem quite a challenge. How, for example, are you going to append the following command line to a temporary batch file:
DIR | FINDSTR /R /I /C:" 0 Dir(s)" >NUL
The following code will definitely not work:
ECHO DIR | FINDSTR /R /I /C:" 0 Dir(s)" >NUL >> TEMPORARY.BAT

For Windows NT 4 and later, you will need to escape the pipe and redirection symbols, which is done by prefixing them with carets ( ˆ ):
ECHO DIR ˆ| FINDSTR /R /I /C:" 0 Dir(s)" ˆ>NUL >> TEMPORARY.BAT
What we have done is tell the ECHO command not to interpret the pipe and the first > symbol but instead to treat them as ondinary characters that must be ECHOed. The escape characters themselves will not be visible in the ECHOed line, so the temporary batch file will contain the normal, unescaped pipe and redirection symbol again.

For "real" DOS, (ab)use the PROMPT codes $L, $G and $B to display and/or redirect pipe and redirection symbols.
Redirection usually results in temporary files. Some notes on this subject can be found on my Temporary Files page.
Read my explanation of standard output and standard error streams.
Take a look at some of the examples available, they will give you an impression of the many possibilities of redirection

Courtesy:http://www.robvanderwoude.com/redirection.php

To Create TLogs using WLST


#========================================================================# Script to update TLOG
#Author: Lokesh T.C
#========================================================================import sys


print "@@@ Starting the script ..."

from java.util import *
from javax.management import *  
from java.io import FileInputStream

print "@@@ Starting the script ..."
global props
  

propInputStream1 = FileInputStream("domain.properties")
domainProps = util.Properties()
domainProps.load(propInputStream1)

#The directory of the domain configuration
#/app/oracle/products/11g/admin/domains
wlsDomain=os.environ["WLSDOMAIN"]
print "WLSDOMAIN="+wlsDomain


adminURL='t3://'+domainProps.get('domain1.AdminIP')+':'+domainProps.get('domain1.AdminPort')
adminUserName='weblogic'
adminPassword=domainProps.get("domain1.AdminPasswd")
connect(adminUserName, adminPassword, adminURL)

edit()
startEdit()

adminserverDir = File(wlsDomain+'/SOACoreDomain/soa_cluster/tlogs')
bool = adminserverDir.mkdirs()

cd('/Servers/MS1')
cd('/Servers/MS1/DefaultFileStore/MS1')
cmo.setDirectory(wlsDomain+'/SOACoreDomain/soa_cluster/tlogs')

cd('/Servers/MS2')
cd('/Servers/MS2/DefaultFileStore/MS2')
cmo.setDirectory(wlsDomain+'/SOACoreDomain/soa_cluster/tlogs')

cd('/Servers/MS3')
cd('/Servers/MS3/DefaultFileStore/MS3')
cmo.setDirectory(wlsDomain+'/SOACoreDomain/soa_cluster/tlogs')

cd('/Servers/MS4')
cd('/Servers/MS4/DefaultFileStore/MS4')
cmo.setDirectory(wlsDomain+'/SOACoreDomain/soa_cluster/tlogs')


cd('/Servers/SOA1')
cd('/Servers/SOA1/DefaultFileStore/SOA1')
cmo.setDirectory(wlsDomain+'/SOACoreDomain/soa_cluster/tlogs')

cd('/Servers/SOA2')
cd('/Servers/SOA2/DefaultFileStore/SOA2')
cmo.setDirectory(wlsDomain+'/SOACoreDomain/soa_cluster/tlogs')

cd('/Servers/SOA3')
cd('/Servers/SOA3/DefaultFileStore/SOA3')
cmo.setDirectory(wlsDomain+'/SOACoreDomain/soa_cluster/tlogs')

cd('/Servers/SOA4')
cd('/Servers/SOA4/DefaultFileStore/SOA4')
cmo.setDirectory(wlsDomain+'/SOACoreDomain/soa_cluster/tlogs')


cd('/Servers/OSB1')
cd('/Servers/OSB1/DefaultFileStore/OSB1')
cmo.setDirectory(wlsDomain+'/SOACoreDomain/soa_cluster/tlogs')

cd('/Servers/OSB2')
cd('/Servers/OSB2/DefaultFileStore/OSB2')
cmo.setDirectory(wlsDomain+'/SOACoreDomain/soa_cluster/tlogs')

cd('/Servers/OSB3')
cd('/Servers/OSB3/DefaultFileStore/OSB3')
cmo.setDirectory(wlsDomain+'/SOACoreDomain/soa_cluster/tlogs')

cd('/Servers/OSB4')
cd('/Servers/OSB4/DefaultFileStore/OSB4')
cmo.setDirectory(wlsDomain+'/SOACoreDomain/soa_cluster/tlogs')
save()
activate()

Saturday, November 19, 2011

Important 11G Links required for upgrading 10G to 11G

Considerations When Upgrading Oracle SOA Applications:
http://download.oracle.com/docs/cd/E12839_01/upgrade.1111/e10127/upgrade_soa_apps.htm

11G Features
https://docs.google.com/present/view?id=0Ad2jlbqzzUGbZGZrM2g2ZDJfNjNnejh2OWJkdg&hl=en_US

SOA Troubleshooting steps:
http://download.oracle.com/docs/cd/E17904_01/integration.1111/e10226/appx_trouble.html

All 10 to 11G challenges:
http://www.ipnweb.com/Portals/0/x1_whitepapers/IPNWeb_UpgradingSOASuite10gto11g_IOUG_Collaborate_2011.pdf

http://albinoraclesoa.blogspot.com

EDG HA GUIDE link (at the botttom)
http://download.oracle.com/docs/cd/E21764_01/core.1111/e12036/net.htm

Installation and Configuration Guide
https://docs.google.com/viewer?a=v&pid=explorer&chrome=true&srcid=0B5SGobvptF_wODNmNzk3ZGYtZjVlNy00ZGYxLWEzNmYtYWRlNjA0NzM5N2Ji&hl=en_US

OSB Guide:
https://docs.google.com/open?id=0B5SGobvptF_wZmU3YWFhZmYtMGMzYy00MGU2LTk4YjEtMGViYTY3MmQ4NTVh


extending domain:
http://download.oracle.com/docs/cd/E21764_01/core.1111/e12036/extend_soa.htm

Server Migration:
http://download.oracle.com/docs/cd/E21764_01/core.1111/e12036/server_migration.htm

Configure Keystores:
http://download.oracle.com/docs/cd/E12840_01/wls/docs103/ConsoleHelp/taskhelp/security/ConfigureKeystoresAndSSL.html

Oracle RAC Services for SAN
http://www.art2dec.com/documentation/docs/fmw11g1114documentation/core.1111/e10106/ap_crs.htm

Configure File and JMS Persistent Store
http://download.oracle.com/docs/cd/E12840_01/wls/docs103/config_wls/store.html#wp1142969

Understanding Server Life Cycle:
http://download.oracle.com/docs/cd/E12840_01/wls/docs103/config_scripting/manage_servers.html

http://download.oracle.com/docs/cd/E14571_01/web.1111/e13706/toc.htm





Install and Configure 11G (11.1.1.5.0) SOA Suite and OSB

As explained in the other posts, we decided to go with two Weblogic Domains where the first domain was named as SOACoreDomain and had three different clusters consisting of SOACluster ,OSBCluster and WLSCoreCluster (for J2EE apps).

- OSBCluster as a front end service layer and mainaly for stateless services that doesn't require transactions.
- SOACoreCluster as a business logic layer for all the stateful services
- WLSCoreCluster as a webservice layer, deploy all the custom webapp.

- Followed almost all the steps in the Oracle EDG Guide.

- Unique Floating IP's were assigned to each of managed servers including Adminserver and this is to be able to start servers independent of physical machines. Since, we didn't had any plan to use extra box in future so decided not to go with MS migratable option and also host verification disabled.

- We used external hardware load balancer--- Configured to route to appropriate Managed Server/Adminserver listening FQIP and port

- Another Domain was named as SOAExtDomain which had only SOAExtCluster. As a well re-known concept in the industry where using Rules and Transformation as service gives a better scalability and maintainability, we always wanted to move rules and transformation related services from SOACoreDomain to this domain so that the SOACoreDomain will have minimal impact if in case if there are any memory issues seen out of these services in future. Performance issues is a common problem associated with large XML transformations as it is a DOM in memory stuff and also same goes with rules. Mostly, these services would disrupt the core services or other in-flight unrelated transactions and hence decided to go with separate domain altogether for such scenarios.

The below link will give you all the information required for installation and configuration and I hope you will enjoy a lot. For all the WLST scripts used in the document, you could refer to a separate posts in this blog.

Click Here to View the document


Friday, November 18, 2011

Create Standalone Weblogic SOA or OSB Domain ( all in one)


#=======================================================================================
# Script to create Weblogic Domain
#Author: Lokesh T.C
#=======================================================================================

import sys


print "@@@ Starting the script ..."
global props
  
from wlstModule import *#@UnusedWildImport
from java.io import FileInputStream

#=======================================================================================
# Create Boot Properties File
#=======================================================================================

def createBootPropertiesFile(directoryPath, username, password):
    adminserverDir = File(directoryPath)
    bool = adminserverDir.mkdirs()
    fileNew=open(directoryPath + '/boot.properties', 'w')
    fileNew.write('username=%s\n' % username)
    fileNew.write('password=%s\n' % password)
    fileNew.flush()
    fileNew.close()

def createNodeManagerPropertiesFile(directoryPath, username, password):
    adminserverDir = File(directoryPath)
    bool = adminserverDir.mkdirs()
    fileNew=open(directoryPath + '/nm_password.properties', 'w')
    fileNew.write('username=%s\n' % username)
    fileNew.write('password=%s\n' % password)
    fileNew.flush()
    fileNew.close()

def createAdminStartupPropertiesFile(directoryPath, args):
    adminserverDir = File(directoryPath)
    bool = adminserverDir.mkdirs()
    fileNew=open(directoryPath + '/startup.properties', 'w')
    args=args.replace(':','\\:')
    args=args.replace('=','\\=')
    fileNew.write('Arguments=%s\n' % args)
    fileNew.flush()
    fileNew.close()

propInputStream = FileInputStream("domain.properties")

configProps = util.Properties()

configProps.load(propInputStream)

#=======================================================================================
# Open a domain template.
#=======================================================================================

#Install directory of Oracle middleware binaries
#/app/oracle/products/11g/fmw
wlsHome=os.environ["MWHOME"]
print "MWHOME="+wlsHome

#Install directory of Oracle Weblogic server
#/app/oracle/products/11g/fmw/wlserver_10.3
wlsServer=os.environ["WLSHOME"]
print "WLSHOME="+wlsServer

#The directory of the domain configuration
#/app/oracle/products/11g/admin/domains
wlsDomain=os.environ["WLSDOMAIN"]
print "WLSDOMAIN="+wlsDomain

#The directory of the SOA domain configuration
#/app/oracle/products/11g/admin/domains/soadomain
#soaDomain=os.environ["SOADOMAIN"]
#print "SOADOMAIN="+soaDomain

#The directory of the BAM domain configuration
#/app/oracle/products/11g/admin/domains/bamdomain
#BAM_DOMAIN

#The directory of the SOA binaries
#/app/oracle/products/11g/fmw/Oracle_SOA
soaHome=os.environ["SOAHOME"]
print "SOAHOME="+soaHome

#The directory of the OSB binaries
#/app/oracle/products/11g/fmw/Oracle_OSB
osbHome=os.environ["OSBHOME"]
print "OSBHOME="+osbHome


#The java6 home directory
javaHome=os.environ["JAVA_HOME"]
JAVA_HOME=javaHome

#SUN

Admin_Java_Arguments= configProps.get("domain1.Admin_Java_Arguments")

#JROCKIT
#Java_Arguments=' -Xms512m -Xmx1024m -XX:PermSize=128m -XX:MaxPermSize=512m -Xnohup '
print "JAVA_HOME="+javaHome

# Administration server configuration
                                                                           
AdminIP= configProps.getProperty("domain1.cadm-vip1")
AdminPort= configProps.getProperty("domain1.AdminPort")
AdminPasswd= configProps.getProperty("domain1.AdminPasswd")

ServerMode = configProps.getProperty("SERVER_MODE")

# SOADomain Datasource Configuration
DBURL= configProps.getProperty("domain1.DBURL")
DBUSER_PREFIX=configProps.getProperty("domain1.DBUSER_PREFIX")
DBPASSWORD=configProps.getProperty("domain1.DBPASSWORD")

#=======================================================================================
# Create a domain from the weblogic domain template.
#=======================================================================================
print 'Reading Weblogic Basic Template'

readTemplate(wlsServer + "/common/templates/domains/wls.jar")
#=======================================================================================
# Configure the Administration Server and SSL port.
# Note: The argument '-Dcom.sun.xml.namespace.QName.useCompatibleSerialVersionUID=1.0'
#       is required for WebLogic servers to run under some versions of Sun JDK 1.5
#=======================================================================================
print 'Creating domain at '+wlsDomain + '/' + sys.argv[1]+'/aserver' + '/' +  sys.argv[1]

DOMAIN_PATH= wlsDomain + '/' + sys.argv[1]+'/aserver' + '/' +  sys.argv[1]
cd('Servers/AdminServer')

set('ListenAddress',AdminIP)
dumpStack()
set('ListenPort', int(AdminPort))

create('AdminServer','SSL')
cd('SSL/AdminServer')
set('Enabled', 'False')
set('HostNameVerificationIgnored', 'True')
cd('../..')

dumpStack()
setOption( "AppDir", DOMAIN_PATH+'/applications' )
create('AdminServer','ServerStart')
cd('ServerStart/AdminServer')
set('Arguments', Admin_Java_Arguments)
set('JavaVendor','Sun')
set('JavaHome',javaHome)

#=======================================================================================
# Define the password for user weblogic. You must define the password before you
# can write the domain.
#=======================================================================================
cd('/')

cmo=cd('Security/base_domain/User/weblogic')
cmo.setPassword(AdminPasswd)
#set('InternalAppsDeployOnDemandEnabled','False')

#=======================================================================================
# Set domain save options:
# - CreateStartMenu:    Enable creation of Start Menu shortcut.
# - ServerStartMode:    Set mode to development.
# - JavaHome:           Sets home directory for the JVM used when starting the server.
# - OverwriteDomain:    Overwrites domain, when saving, if one exists.
#=======================================================================================
setOption('CreateStartMenu', 'false')
setOption('ServerStartMode', ServerMode)
#setOption('JavaVendor', 'Sun')
setOption('JavaHome', javaHome)
setOption('OverwriteDomain', 'true')

print 'Creating domain '+sys.argv[1]+' at'+DOMAIN_PATH

writeDomain(DOMAIN_PATH)
closeTemplate()
createBootPropertiesFile(DOMAIN_PATH+'/servers/AdminServer/security','weblogic',AdminPasswd)
#===========================Read DOMAIN ================================
print 'reading domain from '+DOMAIN_PATH


readDomain(DOMAIN_PATH)

setOption( "AppDir", DOMAIN_PATH+'/applications' )

print 'Adding JAXRPC and JAXWS Webservice Support Template'
#addTemplate(wlsServer + "/common/templates/applications/wls_webservice.jar")
addTemplate(wlsServer + "/common/templates/applications/wls_webservice_jaxws.jar")

dumpStack();

#==================================================================================

cd('/')


print 'Adding SOA Template'
addTemplate(wlsHome+'/oracle_common/common/templates/applications/oracle.applcore.model.stub.11.1.1_template.jar')
addTemplate(wlsHome+'/oracle_common/common/templates/applications/jrf_template_11.1.1.jar')
addTemplate(wlsHome+'/oracle_common/common/templates/applications/oracle.wsmpm_template_11.1.1.jar')
addTemplate(soaHome+'/common/templates/applications/oracle.soa_template_11.1.1.jar')  

print 'Adding EM Template'
addTemplate(wlsHome+'/oracle_common/common/templates/applications/oracle.em_11_1_1_0_0_template.jar')

dumpStack();


cd('/JDBCSystemResource/EDNDataSource/JdbcResource/EDNDataSource/JDBCDriverParams/NO_NAME_0')
set('URL',DBURL)
set('PasswordEncrypted',DBPASSWORD)
cd('Properties/NO_NAME_0/Property/user')
set('Value',DBUSER_PREFIX+'_SOAINFRA')

cd('/JDBCSystemResource/EDNLocalTxDataSource/JdbcResource/EDNLocalTxDataSource/JDBCDriverParams/NO_NAME_0')

set('URL',DBURL)

set('PasswordEncrypted',DBPASSWORD)
cd('Properties/NO_NAME_0/Property/user')
set('Value',DBUSER_PREFIX+'_SOAINFRA')

cd('/JDBCSystemResource/OraSDPMDataSource/JdbcResource/OraSDPMDataSource/JDBCDriverParams/NO_NAME_0')

set('URL',DBURL)

set('PasswordEncrypted',DBPASSWORD)
cd('Properties/NO_NAME_0/Property/user')
set('Value',DBUSER_PREFIX+'_ORASDPM')

cd('/JDBCSystemResource/SOADataSource/JdbcResource/SOADataSource/JDBCDriverParams/NO_NAME_0')

set('URL',DBURL)

set('PasswordEncrypted',DBPASSWORD)
cd('Properties/NO_NAME_0/Property/user')
set('Value',DBUSER_PREFIX+'_SOAINFRA')

cd('/JDBCSystemResource/SOALocalTxDataSource/JdbcResource/SOALocalTxDataSource/JDBCDriverParams/NO_NAME_0')

set('URL',DBURL)

set('PasswordEncrypted',DBPASSWORD)
cd('Properties/NO_NAME_0/Property/user')
set('Value',DBUSER_PREFIX+'_SOAINFRA')

cd('/JDBCSystemResource/mds-owsm/JdbcResource/mds-owsm/JDBCDriverParams/NO_NAME_0')

set('URL',DBURL)

set('PasswordEncrypted',DBPASSWORD)
cd('Properties/NO_NAME_0/Property/user')
set('Value',DBUSER_PREFIX+'_MDS')

cd('/JDBCSystemResource/mds-soa/JdbcResource/mds-soa/JDBCDriverParams/NO_NAME_0')

set('URL',DBURL)

set('PasswordEncrypted',DBPASSWORD)
cd('Properties/NO_NAME_0/Property/user')
set('Value',DBUSER_PREFIX+'_MDS')

#==================================================================================


cd('/')

print 'Deleting default servers & machines'

#delete default servers from the template
delete('LocalMachine', 'Machine')
delete('soa_server1', 'Server')


dumpStack();

print 'Adding OSB Template'
addTemplate(wlsServer + "/common/templates/applications/wls_webservice.jar")
addTemplate(osbHome+'/common/templates/applications/wlsb.jar')

dumpStack();

cd('/')

print 'Deleting default servers'

#delete default servers from the template
delete('osb_server1', 'Server')

#cd('/JDBCSystemResource/wlsbjmsrpDataSource/JdbcResource/wlsbjmsrpDataSource/JDBCDriverParams/NO_NAME_0')

#set('URL',DBURL)

#set('PasswordEncrypted',DBPASSWORD)
#cd('Properties/NO_NAME_0/Property/user')
#set('Value',DBUSER_PREFIX+'_SOAINFRA')

##############UN ASSIGN All#####################

#unassign('StartupClass','*','Target','AdminServer')
#unassign('ShutdownClass','*','Target','AdminServer')
#unassign('Library','*','Target','AdminServer')
#unassign('AppDeployment', '*', 'Target', 'AdminServer')
#unassign('JdbcSystemResource', '*', 'Target', 'AdminServer')
#unassign('WldfSystemResource', '*', 'Target', 'AdminServer')
#unassign('JmsSystemResource', '*', 'Target', 'AdminServer')
#unassign('JmsSystemResource.SubDeployment', '*', 'Target', 'AdminServer')
#unassign('SelfTuning.WorkManager', '*', 'Target', 'AdminServer')

unassign('AppDeployment', 'FMW Welcome Page Application#11.1.0.0.0', 'Target', 'AdminServer')

########################################Assign All##############################################

assign('AppDeployment', 'wsil-wls', 'Target', 'AdminServer')
assign('AppDeployment', 'DMS Application#11.1.1.1.0', 'Target', 'AdminServer')
assign('AppDeployment', 'FileAdapter', 'Target', 'AdminServer')
assign('AppDeployment', 'DbAdapter', 'Target', 'AdminServer')
assign('AppDeployment', 'JmsAdapter', 'Target', 'AdminServer')
assign('AppDeployment', 'AqAdapter', 'Target', 'AdminServer')
assign('AppDeployment', 'FtpAdapter', 'Target', 'AdminServer')
assign('AppDeployment', 'SocketAdapter', 'Target', 'AdminServer')
assign('AppDeployment', 'MQSeriesAdapter', 'Target', 'AdminServer')
assign('AppDeployment', 'OracleAppsAdapter', 'Target', 'AdminServer')
assign('AppDeployment', 'OracleBamAdapter', 'Target', 'AdminServer')
assign('AppDeployment', 'wsm-pm', 'Target', 'AdminServer')
assign('AppDeployment', 'usermessagingserver', 'Target', 'AdminServer')
assign('AppDeployment', 'usermessagingdriver-email', 'Target', 'AdminServer')


assign('AppDeployment', 'soa-infra', 'Target', 'AdminServer')
assign('AppDeployment', 'worklistapp', 'Target', 'AdminServer')
assign('AppDeployment', 'b2bui', 'Target', 'AdminServer')
assign('AppDeployment', 'DefaultToDoTaskFlow', 'Target', 'AdminServer')
assign('AppDeployment', 'composer', 'Target', 'AdminServer')
assign('AppDeployment', 'ALSB Framework Starter Application', 'Target', 'AdminServer')
assign('AppDeployment', 'ALSB Coherence Cache Provider', 'Target', 'AdminServer')
assign('AppDeployment', 'XBus Kernel', 'Target', 'AdminServer')


assign('AppDeployment.SubDeployment', '/httpTransport', 'Target', 'AdminServer')


assign('AppDeployment', 'ALSB UDDI Manager', 'Target', 'AdminServer')

assign('AppDeployment', 'ALSB Subscription Listener', 'Target', 'AdminServer')
assign('AppDeployment', 'JMS Reporting Provider', 'Target', 'AdminServer')
#assign('AppDeployment', 'Message Reporting Purger', 'Target', 'AdminServer') #osbserver
assign('AppDeployment', 'Ftp Transport Provider', 'Target', 'AdminServer')
assign('AppDeployment', 'SFTP Transport Provider', 'Target', 'AdminServer')
assign('AppDeployment', 'Email Transport Provider', 'Target', 'AdminServer')
assign('AppDeployment', 'File Transport Provider', 'Target', 'AdminServer')
assign('AppDeployment', 'MQ Transport Provider', 'Target', 'AdminServer')
assign('AppDeployment', 'EJB Transport Provider', 'Target', 'AdminServer')
assign('AppDeployment', 'Tuxedo Transport Provider', 'Target', 'AdminServer')
assign('AppDeployment', 'ALDSP Transport Provider', 'Target', 'AdminServer')
assign('AppDeployment', 'SB Transport Provider', 'Target', 'AdminServer')
assign('AppDeployment', 'WS Transport Provider', 'Target', 'AdminServer')
assign('AppDeployment', 'WS Transport Async Applcation', 'Target', 'AdminServer')
assign('AppDeployment', 'FLOW Transport Provider', 'Target', 'AdminServer')
assign('AppDeployment', 'BPEL 10g Transport Provider', 'Target', 'AdminServer')
assign('AppDeployment', 'JCA Transport Provider', 'Target', 'AdminServer')
assign('AppDeployment', 'JEJB Transport Provider', 'Target', 'AdminServer')
assign('AppDeployment', 'SOA-DIRECT Transport Provider', 'Target', 'AdminServer')
assign('AppDeployment', 'ALSB Routing', 'Target', 'AdminServer')
assign('AppDeployment', 'ALSB Transform', 'Target', 'AdminServer')
assign('AppDeployment', 'ALSB Publish', 'Target', 'AdminServer')
assign('AppDeployment', 'ALSB Logging', 'Target', 'AdminServer')
assign('AppDeployment', 'ALSB Resource', 'Target', 'AdminServer')
assign('AppDeployment', 'ALSB WSIL', 'Target', 'AdminServer')
assign('AppDeployment', 'ServiceBus_Console', 'Target', 'AdminServer')


assign('AppDeployment', 'ALSB Test Framework', 'Target', 'AdminServer')
assign('Library', 'oracle.bi.jbips#11.1.1@0.1', 'Target', 'AdminServer')
assign('Library', 'oracle.bi.composer#11.1.1@0.1', 'Target', 'AdminServer')
assign('Library', 'oracle.bi.adf.model.slib#1.0@11.1.1.2.0', 'Target', 'AdminServer')
assign('Library', 'oracle.bi.adf.view.slib#1.0@11.1.1.2.0', 'Target', 'AdminServer')
assign('Library', 'oracle.bi.adf.webcenter.slib#1.0@11.1.1.2.0', 'Target', 'AdminServer')
assign('Library', 'oracle.wsm.seedpolicies#11.1.1@11.1.1', 'Target', 'AdminServer') #Revisit
assign('Library', 'oracle.jsp.next#11.1.1@11.1.1', 'Target', 'AdminServer')
assign('Library', 'oracle.dconfig-infra#11@11.1.1.1.0', 'Target', 'AdminServer')
assign('Library', 'orai18n-adf#11@11.1.1.1.0', 'Target', 'AdminServer')
assign('Library', 'oracle.adf.dconfigbeans#1.0@11.1.1.2.0', 'Target', 'AdminServer')
assign('Library', 'oracle.pwdgen#11.1.1@11.1.1.2.0', 'Target', 'AdminServer')
assign('Library', 'oracle.jrf.system.filter', 'Target', 'AdminServer')
assign('Library', 'adf.oracle.domain#1.0@11.1.1.2.0', 'Target', 'AdminServer')
assign('Library', 'adf.oracle.businesseditor#1.0@11.1.1.2.0', 'Target', 'AdminServer')
assign('Library', 'oracle.adf.management#1.0@11.1.1.2.0', 'Target', 'AdminServer')
assign('Library', 'adf.oracle.domain.webapp#1.0@11.1.1.2.0', 'Target', 'AdminServer')
assign('Library', 'jsf#1.2@1.2.9.0', 'Target', 'AdminServer')
assign('Library', 'UIX#11@11.1.1.1.0', 'Target', 'AdminServer')
assign('Library', 'ohw-rcf#5@5.0', 'Target', 'AdminServer')
assign('Library', 'ohw-uix#5@5.0', 'Target', 'AdminServer')
assign('Library', 'oracle.adf.desktopintegration.model#1.0@11.1.1.2.0', 'Target', 'AdminServer')
assign('Library', 'oracle.adf.desktopintegration#1.0@11.1.1.2.0', 'Target', 'AdminServer')
assign('Library', 'oracle.rules#11.1.1@11.1.1', 'Target', 'AdminServer'+',AdminServer')
assign('Library', 'oracle.sdp.client#11.1.1@11.1.1', 'Target', 'AdminServer')
assign('Library', 'oracle.soa.workflow.wc#11.1.1@11.1.1', 'Target', 'AdminServer')
assign('Library', 'oracle.soa.worklist.webapp#11.1.1@11.1.1', 'Target', 'AdminServer')
assign('Library', 'oracle.soa.rules_editor_dc.webapp#11.1.1@11.1.1', 'Target', 'AdminServer')
assign('Library', 'oracle.soa.rules_dict_dc.webapp#11.1.1@11.1.1', 'Target', 'AdminServer')
assign('Library', 'oracle.sdp.messaging#11.1.1@11.1.1', 'Target', 'AdminServer')
assign('Library', 'oracle.soa.worklist#11.1.1@11.1.1', 'Target', 'AdminServer')
assign('Library', 'oracle.soa.bpel#11.1.1@11.1.1', 'Target', 'AdminServer')
assign('Library', 'oracle.soa.workflow#11.1.1@11.1.1', 'Target', 'AdminServer')
assign('Library', 'oracle.soa.mediator#11.1.1@11.1.1', 'Target', 'AdminServer')
assign('Library', 'oracle.soa.composer.webapp#11.1.1@11.1.1', 'Target', 'AdminServer')
assign('Library', 'oracle.soa.ext#11.1.1@11.1.1', 'Target', 'AdminServer')
assign('Library', 'oracle.jrf.coherence#3@11.1.1', 'Target', 'AdminServer')
assign('Library', 'coherence-l10n#11.1.1@11.1.1', 'Target', 'AdminServer')
assign('Library', 'ftptransport-l10n#2.5@2.5', 'Target', 'AdminServer')
assign('Library', 'sftptransport-l10n#3.0@3.0', 'Target', 'AdminServer')
assign('Library', 'emailtransport-l10n#2.5@2.5', 'Target', 'AdminServer')
assign('Library', 'filetransport-l10n#2.5@2.5', 'Target', 'AdminServer')
assign('Library', 'mqtransport-l10n#3.0@3.0', 'Target', 'AdminServer')
assign('Library', 'mqconnection-l10n#3.0@3.0', 'Target', 'AdminServer')
assign('Library', 'ejbtransport-l10n#2.5@2.5', 'Target', 'AdminServer')
assign('Library', 'tuxedotransport-l10n#2.5@2.5', 'Target', 'AdminServer')
assign('Library', 'aldsp_transport-l10n#3.0@3.0', 'Target', 'AdminServer')
assign('Library', 'wstransport-l10n#2.6@2.6', 'Target', 'AdminServer')
assign('Library', 'flow-transport-l10n#3.0@3.0', 'Target', 'AdminServer')
assign('Library', 'bpel10gtransport-l10n#3.1@3.1', 'Target', 'AdminServer')
assign('Library', 'jcatransport-l10n#3.1@3.1', 'Target', 'AdminServer')
assign('Library', 'wsif#11.1.1@11.1.1', 'Target', 'AdminServer')
assign('Library', 'JCAFrameworkImpl#11.1.1@11.1.1', 'Target', 'AdminServer')
assign('Library', 'jejbtransport-l10n#3.2@3.2', 'Target', 'AdminServer')
assign('Library', 'jejbtransport-jar#3.2@3.2', 'Target', 'AdminServer')
assign('Library', 'soatransport-l10n#11.1.1.2.0@11.1.1.2.0', 'Target', 'AdminServer')
assign('Library', 'stage-utils#2.5@2.5', 'Target', 'AdminServer')
assign('Library', 'sbconsole-l10n#2.5@2.5', 'Target', 'AdminServer')
assign('Library', 'xbusrouting-l10n#2.5@2.5', 'Target', 'AdminServer')
assign('Library', 'xbustransform-l10n#2.5@2.5', 'Target', 'AdminServer')
assign('Library', 'xbuspublish-l10n#2.5@2.5', 'Target', 'AdminServer')
assign('Library', 'xbuslogging-l10n#2.5@2.5', 'Target', 'AdminServer')
assign('Library', 'testfwk-l10n#2.5@2.5', 'Target', 'AdminServer')
assign('Library', 'com.bea.wlp.lwpf.console.app#10.3.0@10.3.0', 'Target', 'AdminServer')
assign('Library', 'com.bea.wlp.lwpf.console.web#10.3.0@10.3.0', 'Target', 'AdminServer')
assign('Library', 'wlp-lookandfeel-web-lib#10.3.0@10.3.0', 'Target', 'AdminServer')
assign('Library', 'wlp-light-web-lib#10.3.0@10.3.0', 'Target', 'AdminServer')
assign('Library', 'wlp-framework-common-web-lib#10.3.0@10.3.0', 'Target', 'AdminServer')
assign('Library', 'wlp-framework-struts-1.2-web-lib#10.3.0@10.3.0', 'Target', 'AdminServer')
assign('Library', 'struts-1.2#1.2@1.2.9', 'Target', 'AdminServer')
assign('Library', 'beehive-netui-1.0.1-10.0#1.0@1.0.2.2', 'Target', 'AdminServer')
assign('Library', 'beehive-netui-resources-1.0.1-10.0#1.0@1.0.2.2', 'Target', 'AdminServer')
assign('Library', 'beehive-controls-1.0.1-10.0-war#1.0@1.0.2.2', 'Target', 'AdminServer')
assign('Library', 'weblogic-controls-10.0-war#10.0@10.2', 'Target', 'AdminServer')
assign('Library', 'wls-commonslogging-bridge-war#1.0@1.1', 'Target', 'AdminServer')
assign('Library', 'jstl#1.2@1.2.0.1', 'Target', 'AdminServer')

assign('Library', 'oracle.applcore.model#0.1@11.1.1.0.0', 'Target', 'AdminServer')
assign('Library', 'oracle.applcore.view#0.1@11.1.1.0.0', 'Target', 'AdminServer')


dumpStack();

#assign('SelfTuning.WorkManager', 'weblogic.wsee.mdb.DispatchPolicy', 'Target', 'AdminServer')
dumpStack();

#assign('SelfTuning.WorkManager', 'weblogic.wsee.jaxws.mdb.DispatchPolicy', 'Target', 'AdminServer')
#assign('SelfTuning.WorkManager', 'wm/SOAWorkManager', 'Target', 'AdminServer')
dumpStack();



assign('ShutdownClass', 'JOC-Shutdown', 'Target', 'AdminServer')
assign('ShutdownClass', 'DMSShutdown', 'Target', 'AdminServer')
assign('StartupClass', 'JRF Startup Class', 'Target', 'AdminServer')
assign('StartupClass', 'JPS Startup Class', 'Target', 'AdminServer')
assign('StartupClass', 'ODL-Startup', 'Target', 'AdminServer')
assign('StartupClass', 'Audit Loader Startup Class', 'Target', 'AdminServer')
assign('StartupClass', 'AWT Application Context Startup Class', 'Target', 'AdminServer')
assign('StartupClass', 'JMX Framework Startup Class', 'Target', 'AdminServer')
assign('StartupClass', 'Web Services Startup Class', 'Target', 'AdminServer') #Revisit
assign('StartupClass', 'JOC-Startup', 'Target', 'AdminServer')
assign('StartupClass', 'DMS-Startup', 'Target', 'AdminServer')
assign('StartupClass', 'SOAStartupClass', 'Target', 'AdminServer')
assign('StartupClass', 'OSB JCA Transport Post-Activation Startup Class', 'Target', 'AdminServer')


assign('JmsSystemResource', 'WseeJaxwsJmsModule', 'Target', 'AdminServer')
assign('JmsSystemResource', 'WseeJmsModule', 'Target', 'AdminServer')
dumpStack();


assign('JmsSystemResource', 'UMSJMSSystemResource', 'Target', 'AdminServer')
assign('JmsSystemResource', 'BPMJMSModule', 'Target', 'AdminServer')

assign('JmsSystemResource', 'SOAJMSModule', 'Target', 'AdminServer')
assign('JmsSystemResource', 'jmsResources', 'Target', 'AdminServer')

assign('WldfSystemResource', 'Module-FMWDFW', 'Target', 'AdminServer')
assign('JdbcSystemResource', 'mds-owsm', 'Target', 'AdminServer'+',AdminServer')
assign('JdbcSystemResource', 'OraSDPMDataSource', 'Target', 'AdminServer')
assign('JdbcSystemResource', 'SOADataSource', 'Target', 'AdminServer')
assign('JdbcSystemResource', 'EDNDataSource', 'Target', 'AdminServer')
assign('JdbcSystemResource', 'EDNLocalTxDataSource', 'Target', 'AdminServer')
assign('JdbcSystemResource', 'SOALocalTxDataSource', 'Target', 'AdminServer')
assign('JdbcSystemResource', 'mds-soa', 'Target', 'AdminServer'+',AdminServer')
unassign('JdbcSystemResource', 'wlsbjmsrpDataSource', 'Target', 'AdminServer')


#=======================================================================================
# Write the domain and close the domain template.
#=======================================================================================
print 'Creating configurations...'
dumpStack();

#writeDomain(DOMAIN_PATH)
updateDomain()
dumpStack();

#===========================Read DOMAIN ================================
print 'reading domain from '+DOMAIN_PATH

closeDomain();
readDomain(DOMAIN_PATH)

setOption( "AppDir", DOMAIN_PATH+'/applications' )

assign('AppDeployment', 'ALSB Cluster Singleton Marker Application', 'Target', 'AdminServer') #osbserver
assign('AppDeployment', 'ALSB Domain Singleton Marker Application', 'Target', 'AdminServer') #osbserver

cd('/SecurityConfiguration/'+sys.argv[1])
set('NodeManagerUsername', 'weblogic')
set('NodeManagerPasswordEncrypted', AdminPasswd)
updateDomain()
closeDomain()

print 'Successfully created domain.'
createNodeManagerPropertiesFile(DOMAIN_PATH+'/config/nodemanager','weblogic',AdminPasswd)
createAdminStartupPropertiesFile(DOMAIN_PATH+'/servers/AdminServer/data/nodemanager',Admin_Java_Arguments)  
 
exit()

Thursday, November 10, 2011

Migrate the Default JMS FileStore to JDBC Store using WLST

Create a Custom JDBC DataSource and use the script below, remove what ever you dont like or want it..

#=======================================================================================
# Script to update JMSStore
#Author: Lokesh T.C
#=======================================================================================
import sys

print "@@@ Starting the script ..."
from java.util import *
from javax.management import *  
from java.io import FileInputStream
propInputStream1 = FileInputStream("domain.properties")
domainProps = util.Properties()
domainProps.load(propInputStream1)
#The directory of the domain configuration
#/app/oracle/products/11g/admin/domains
wlsDomain=os.environ["WLSDOMAIN"]
print "WLSDOMAIN="+wlsDomain

adminURL='t3://'+domainProps.get('domain1.AdminIP')+':'+domainProps.get('domain1.AdminPort')
adminUserName='weblogic'
adminPassword=domainProps.get("domain1.AdminPasswd")
connect(adminUserName, adminPassword, adminURL)
edit()
startEdit()
if sys.argv[1] == 'Cluster':
 ###################Create JDBC Stores for cluster####################
 cd('/')
 cmo.createJDBCStore('WseeJaxwsJDBCStore_auto_1')
 cd('/JDBCStores/WseeJaxwsJDBCStore_auto_1')
 cmo.setDataSource(getMBean('/SystemResources/EAIJMSDataSource'))
 cmo.setPrefixName('WseeJaxws1')
 set('Targets',jarray.array([ObjectName('com.bea:Name=MS1,Type=Server')], ObjectName))
 cd('/')
 cmo.createJDBCStore('WseeJaxwsJDBCStore_auto_2')
 cd('/JDBCStores/WseeJaxwsJDBCStore_auto_2')
 cmo.setDataSource(getMBean('/SystemResources/EAIJMSDataSource'))
 cmo.setPrefixName('WseeJaxws2')
 set('Targets',jarray.array([ObjectName('com.bea:Name=MS2,Type=Server')], ObjectName))
 cd('/')
 cmo.createJDBCStore('WseeJaxwsJDBCStore_auto_3')
 cd('/JDBCStores/WseeJaxwsJDBCStore_auto_3')
 cmo.setDataSource(getMBean('/SystemResources/EAIJMSDataSource'))
 cmo.setPrefixName('WseeJaxws3')
 set('Targets',jarray.array([ObjectName('com.bea:Name=MS3,Type=Server')], ObjectName))
 cd('/')
 cmo.createJDBCStore('WseeJaxwsJDBCStore_auto_4')
 cd('/JDBCStores/WseeJaxwsJDBCStore_auto_4')
 cmo.setDataSource(getMBean('/SystemResources/EAIJMSDataSource'))
 cmo.setPrefixName('WseeJaxws4')
 set('Targets',jarray.array([ObjectName('com.bea:Name=MS4,Type=Server')], ObjectName))
 cd('/')
 cmo.createJDBCStore('WseeJDBCStore_auto_1')
 cd('/JDBCStores/WseeJDBCStore_auto_1')
 cmo.setDataSource(getMBean('/SystemResources/EAIJMSDataSource'))
 cmo.setPrefixName('Wsee1')
 set('Targets',jarray.array([ObjectName('com.bea:Name=MS1,Type=Server')], ObjectName))
 cd('/')
 cmo.createJDBCStore('WseeJDBCStore_auto_2')
 cd('/JDBCStores/WseeJDBCStore_auto_2')
 cmo.setDataSource(getMBean('/SystemResources/EAIJMSDataSource'))
 cmo.setPrefixName('Wsee2')
 set('Targets',jarray.array([ObjectName('com.bea:Name=MS2,Type=Server')], ObjectName))
 cd('/')
 cmo.createJDBCStore('WseeJDBCStore_auto_3')
 cd('/JDBCStores/WseeJDBCStore_auto_3')
 cmo.setDataSource(getMBean('/SystemResources/EAIJMSDataSource'))
 cmo.setPrefixName('Wsee3')
 set('Targets',jarray.array([ObjectName('com.bea:Name=MS3,Type=Server')], ObjectName))
 cd('/')
 cmo.createJDBCStore('WseeJDBCStore_auto_4')
 cd('/JDBCStores/WseeJDBCStore_auto_4')
 cmo.setDataSource(getMBean('/SystemResources/EAIJMSDataSource'))
 cmo.setPrefixName('Wsee4')
 set('Targets',jarray.array([ObjectName('com.bea:Name=MS4,Type=Server')], ObjectName))
 cd('/')
 cmo.createJDBCStore('WseeJDBCStore_auto_5')
 cd('/JDBCStores/WseeJDBCStore_auto_5')
 cmo.setDataSource(getMBean('/SystemResources/EAIJMSDataSource'))
 cmo.setPrefixName('WseeOSB5')
 set('Targets',jarray.array([ObjectName('com.bea:Name=OSB1,Type=Server')], ObjectName))
 cd('/')
 cmo.createJDBCStore('WseeJDBCStore_auto_6')
 cd('/JDBCStores/WseeJDBCStore_auto_6')
 cmo.setDataSource(getMBean('/SystemResources/EAIJMSDataSource'))
 cmo.setPrefixName('WseeOSB6')
 set('Targets',jarray.array([ObjectName('com.bea:Name=OSB2,Type=Server')], ObjectName))
 cd('/')
 cmo.createJDBCStore('WseeJDBCStore_auto_7')
 cd('/JDBCStores/WseeJDBCStore_auto_7')
 cmo.setDataSource(getMBean('/SystemResources/EAIJMSDataSource'))
 cmo.setPrefixName('WseeOSB7')
 set('Targets',jarray.array([ObjectName('com.bea:Name=OSB3,Type=Server')], ObjectName))
 cd('/')
 cmo.createJDBCStore('WseeJDBCStore_auto_8')
 cd('/JDBCStores/WseeJDBCStore_auto_8')
 cmo.setDataSource(getMBean('/SystemResources/EAIJMSDataSource'))
 cmo.setPrefixName('WseeOSB8')
 set('Targets',jarray.array([ObjectName('com.bea:Name=OSB4,Type=Server')], ObjectName))
 cd('/')
 cmo.createJDBCStore('UMSJMSJDBCStore_auto_1')
 cd('/JDBCStores/UMSJMSJDBCStore_auto_1')
 cmo.setDataSource(getMBean('/SystemResources/EAIJMSDataSource'))
 cmo.setPrefixName('UMSJMS1')
 set('Targets',jarray.array([ObjectName('com.bea:Name=SOA1,Type=Server')], ObjectName))
 cd('/')
 cmo.createJDBCStore('UMSJMSJDBCStore_auto_2')
 cd('/JDBCStores/UMSJMSJDBCStore_auto_2')
 cmo.setDataSource(getMBean('/SystemResources/EAIJMSDataSource'))
 cmo.setPrefixName('UMSJMS2')
 set('Targets',jarray.array([ObjectName('com.bea:Name=SOA2,Type=Server')], ObjectName))
 cd('/')
 cmo.createJDBCStore('UMSJMSJDBCStore_auto_3')
 cd('/JDBCStores/UMSJMSJDBCStore_auto_3')
 cmo.setDataSource(getMBean('/SystemResources/EAIJMSDataSource'))
 cmo.setPrefixName('UMSJMS3')
 set('Targets',jarray.array([ObjectName('com.bea:Name=SOA3,Type=Server')], ObjectName))
 cd('/')
 cmo.createJDBCStore('UMSJMSJDBCStore_auto_4')
 cd('/JDBCStores/UMSJMSJDBCStore_auto_4')
 cmo.setDataSource(getMBean('/SystemResources/EAIJMSDataSource'))
 cmo.setPrefixName('UMSJMS4')
 set('Targets',jarray.array([ObjectName('com.bea:Name=SOA4,Type=Server')], ObjectName))
 cd('/')
 cmo.createJDBCStore('BPMJMSJDBCStore_auto_1')
 cd('/JDBCStores/BPMJMSJDBCStore_auto_1')
 cmo.setDataSource(getMBean('/SystemResources/EAIJMSDataSource'))
 cmo.setPrefixName('BPMJMS1')
 set('Targets',jarray.array([ObjectName('com.bea:Name=SOA1,Type=Server')], ObjectName))
 cd('/')
 cmo.createJDBCStore('BPMJMSJDBCStore_auto_2')
 cd('/JDBCStores/BPMJMSJDBCStore_auto_2')
 cmo.setDataSource(getMBean('/SystemResources/EAIJMSDataSource'))
 cmo.setPrefixName('BPMJMS2')
 set('Targets',jarray.array([ObjectName('com.bea:Name=SOA2,Type=Server')], ObjectName))
 cd('/')
 cmo.createJDBCStore('BPMJMSJDBCStore_auto_3')
 cd('/JDBCStores/BPMJMSJDBCStore_auto_3')
 cmo.setDataSource(getMBean('/SystemResources/EAIJMSDataSource'))
 cmo.setPrefixName('BPMJMS3')
 set('Targets',jarray.array([ObjectName('com.bea:Name=SOA3,Type=Server')], ObjectName))
 cd('/')
 cmo.createJDBCStore('BPMJMSJDBCStore_auto_4')
 cd('/JDBCStores/BPMJMSJDBCStore_auto_4')
 cmo.setDataSource(getMBean('/SystemResources/EAIJMSDataSource'))
 cmo.setPrefixName('BPMJMS4')
 set('Targets',jarray.array([ObjectName('com.bea:Name=SOA4,Type=Server')], ObjectName))
 cd('/')
 cmo.createJDBCStore('SOAJMSJDBCStore_auto_1')
 cd('/JDBCStores/SOAJMSJDBCStore_auto_1')
 cmo.setDataSource(getMBean('/SystemResources/EAIJMSDataSource'))
 cmo.setPrefixName('SOAJMS1')
 set('Targets',jarray.array([ObjectName('com.bea:Name=SOA1,Type=Server')], ObjectName))
 cd('/')
 cmo.createJDBCStore('SOAJMSJDBCStore_auto_2')
 cd('/JDBCStores/SOAJMSJDBCStore_auto_2')
 cmo.setDataSource(getMBean('/SystemResources/EAIJMSDataSource'))
 cmo.setPrefixName('SOAJMS2')
 set('Targets',jarray.array([ObjectName('com.bea:Name=SOA2,Type=Server')], ObjectName))
 cd('/')
 cmo.createJDBCStore('SOAJMSJDBCStore_auto_3')
 cd('/JDBCStores/SOAJMSJDBCStore_auto_3')
 cmo.setDataSource(getMBean('/SystemResources/EAIJMSDataSource'))
 cmo.setPrefixName('SOAJMS3')
 set('Targets',jarray.array([ObjectName('com.bea:Name=SOA3,Type=Server')], ObjectName))
 cd('/')
 cmo.createJDBCStore('SOAJMSJDBCStore_auto_4')
 cd('/JDBCStores/SOAJMSJDBCStore_auto_4')
 cmo.setDataSource(getMBean('/SystemResources/EAIJMSDataSource'))
 cmo.setPrefixName('SOAJMS4')
 set('Targets',jarray.array([ObjectName('com.bea:Name=SOA4,Type=Server')], ObjectName))
 cd('/')
 cmo.createJDBCStore('JDBCStore_auto_1')
 cd('/JDBCStores/JDBCStore_auto_1')
 cmo.setDataSource(getMBean('/SystemResources/EAIJMSDataSource'))
 cmo.setPrefixName('JDBCStore1')
 set('Targets',jarray.array([ObjectName('com.bea:Name=OSB1,Type=Server')], ObjectName))
 cd('/')
 cmo.createJDBCStore('JDBCStore_auto_2')
 cd('/JDBCStores/JDBCStore_auto_2')
 cmo.setDataSource(getMBean('/SystemResources/EAIJMSDataSource'))
 cmo.setPrefixName('JDBCStore2')
 set('Targets',jarray.array([ObjectName('com.bea:Name=OSB2,Type=Server')], ObjectName))
 cd('/')
 cmo.createJDBCStore('JDBCStore_auto_3')
 cd('/JDBCStores/JDBCStore_auto_3')
 cmo.setDataSource(getMBean('/SystemResources/EAIJMSDataSource'))
 cmo.setPrefixName('JDBCStore3')
 set('Targets',jarray.array([ObjectName('com.bea:Name=OSB3,Type=Server')], ObjectName))
 cd('/')
 cmo.createJDBCStore('JDBCStore_auto_4')
 cd('/JDBCStores/JDBCStore_auto_4')
 cmo.setDataSource(getMBean('/SystemResources/EAIJMSDataSource'))
 cmo.setPrefixName('JDBCStore4')
 set('Targets',jarray.array([ObjectName('com.bea:Name=OSB4,Type=Server')], ObjectName))
 ################  end of JDBC Stores ####################
 ############Set Persistent Stores for all the JMS Servers for cluster
 cd('/Deployments/WseeJaxwsJmsServer_auto_1')
 cmo.setPersistentStore(getMBean('/JDBCStores/WseeJaxwsJDBCStore_auto_1'))

 cd('/Deployments/WseeJaxwsJmsServer_auto_2')
 cmo.setPersistentStore(getMBean('/JDBCStores/WseeJaxwsJDBCStore_auto_2'))

 cd('/Deployments/WseeJaxwsJmsServer_auto_3')
 cmo.setPersistentStore(getMBean('/JDBCStores/WseeJaxwsJDBCStore_auto_3'))

 cd('/Deployments/WseeJaxwsJmsServer_auto_4')
 cmo.setPersistentStore(getMBean('/JDBCStores/WseeJaxwsJDBCStore_auto_4'))

 cd('/Deployments/WseeJmsServer_auto_1')
 cmo.setPersistentStore(getMBean('/JDBCStores/WseeJDBCStore_auto_1'))

 cd('/Deployments/WseeJmsServer_auto_2')
 cmo.setPersistentStore(getMBean('/JDBCStores/WseeJDBCStore_auto_2'))

 cd('/Deployments/WseeJmsServer_auto_3')
 cmo.setPersistentStore(getMBean('/JDBCStores/WseeJDBCStore_auto_3'))

 cd('/Deployments/WseeJmsServer_auto_4')
 cmo.setPersistentStore(getMBean('/JDBCStores/WseeJDBCStore_auto_4'))

 cd('/Deployments/WseeJmsServer_auto_5')
 cmo.setPersistentStore(getMBean('/JDBCStores/WseeJDBCStore_auto_5'))

 cd('/Deployments/WseeJmsServer_auto_6')
 cmo.setPersistentStore(getMBean('/JDBCStores/WseeJDBCStore_auto_6'))

 cd('/Deployments/WseeJmsServer_auto_7')
 cmo.setPersistentStore(getMBean('/JDBCStores/WseeJDBCStore_auto_7'))

 cd('/Deployments/WseeJmsServer_auto_8')
 cmo.setPersistentStore(getMBean('/JDBCStores/WseeJDBCStore_auto_8'))

 cd('/Deployments/UMSJMSServer_auto_1')
 cmo.setPersistentStore(getMBean('/JDBCStores/UMSJMSJDBCStore_auto_1'))

 cd('/Deployments/UMSJMSServer_auto_2')
 cmo.setPersistentStore(getMBean('/JDBCStores/UMSJMSJDBCStore_auto_2'))

 cd('/Deployments/UMSJMSServer_auto_3')
 cmo.setPersistentStore(getMBean('/JDBCStores/UMSJMSJDBCStore_auto_3'))

 cd('/Deployments/UMSJMSServer_auto_4')
 cmo.setPersistentStore(getMBean('/JDBCStores/UMSJMSJDBCStore_auto_4'))

 cd('/Deployments/BPMJMSServer_auto_1')
 cmo.setPersistentStore(getMBean('/JDBCStores/BPMJMSJDBCStore_auto_1'))

 cd('/Deployments/BPMJMSServer_auto_2')
 cmo.setPersistentStore(getMBean('/JDBCStores/BPMJMSJDBCStore_auto_2'))

 cd('/Deployments/BPMJMSServer_auto_3')
 cmo.setPersistentStore(getMBean('/JDBCStores/BPMJMSJDBCStore_auto_3'))

 cd('/Deployments/BPMJMSServer_auto_4')
 cmo.setPersistentStore(getMBean('/JDBCStores/BPMJMSJDBCStore_auto_4'))

 cd('/Deployments/SOAJMSServer_auto_1')
 cmo.setPersistentStore(getMBean('/JDBCStores/SOAJMSJDBCStore_auto_1'))

 cd('/Deployments/SOAJMSServer_auto_2')
 cmo.setPersistentStore(getMBean('/JDBCStores/SOAJMSJDBCStore_auto_2'))

 cd('/Deployments/SOAJMSServer_auto_3')
 cmo.setPersistentStore(getMBean('/JDBCStores/SOAJMSJDBCStore_auto_3'))

 cd('/Deployments/SOAJMSServer_auto_4')
 cmo.setPersistentStore(getMBean('/JDBCStores/SOAJMSJDBCStore_auto_4'))

 cd('/Deployments/wlsbJMSServer_auto_1')
 cmo.setPersistentStore(getMBean('/JDBCStores/JDBCStore_auto_1'))


 cd('/Deployments/wlsbJMSServer_auto_2')
 cmo.setPersistentStore(getMBean('/JDBCStores/JDBCStore_auto_2'))


 cd('/Deployments/wlsbJMSServer_auto_3')
 cmo.setPersistentStore(getMBean('/JDBCStores/JDBCStore_auto_3'))


 cd('/Deployments/wlsbJMSServer_auto_4')
 cmo.setPersistentStore(getMBean('/JDBCStores/JDBCStore_auto_4'))

 ##### Set the persistent stores for all SAF agents
 cd('/SAFAgents/ReliableWseeJaxwsSAFAgent_MS1')
 cmo.setStore(getMBean('/JDBCStores/WseeJaxwsJDBCStore_auto_1'))

 cd('/SAFAgents/ReliableWseeJaxwsSAFAgent_MS2')
 cmo.setStore(getMBean('/JDBCStores/WseeJaxwsJDBCStore_auto_2'))

 cd('/SAFAgents/ReliableWseeJaxwsSAFAgent_MS3')
 cmo.setStore(getMBean('/JDBCStores/WseeJaxwsJDBCStore_auto_3'))

 cd('/SAFAgents/ReliableWseeJaxwsSAFAgent_MS4')
 cmo.setStore(getMBean('/JDBCStores/WseeJaxwsJDBCStore_auto_4'))
 #################DESTROY ALL THE FILE STORES
 cd('/')
 cmo.destroyFileStore(getMBean('/FileStores/WseeJaxwsFileStore_auto_1'))
 cmo.destroyFileStore(getMBean('/FileStores/WseeJaxwsFileStore_auto_2'))
 cmo.destroyFileStore(getMBean('/FileStores/WseeJaxwsFileStore_auto_3'))
 cmo.destroyFileStore(getMBean('/FileStores/WseeJaxwsFileStore_auto_4'))
 cmo.destroyFileStore(getMBean('/FileStores/WseeFileStore_auto_1'))
 cmo.destroyFileStore(getMBean('/FileStores/WseeFileStore_auto_2'))
 cmo.destroyFileStore(getMBean('/FileStores/WseeFileStore_auto_3'))
 cmo.destroyFileStore(getMBean('/FileStores/WseeFileStore_auto_4'))
 cmo.destroyFileStore(getMBean('/FileStores/WseeFileStore_auto_5'))
 cmo.destroyFileStore(getMBean('/FileStores/WseeFileStore_auto_6'))
 cmo.destroyFileStore(getMBean('/FileStores/WseeFileStore_auto_7'))
 cmo.destroyFileStore(getMBean('/FileStores/WseeFileStore_auto_8'))
 cmo.destroyFileStore(getMBean('/FileStores/UMSJMSFileStore_auto_1'))
 cmo.destroyFileStore(getMBean('/FileStores/UMSJMSFileStore_auto_2'))
 cmo.destroyFileStore(getMBean('/FileStores/UMSJMSFileStore_auto_3'))
 cmo.destroyFileStore(getMBean('/FileStores/UMSJMSFileStore_auto_4'))
 cmo.destroyFileStore(getMBean('/FileStores/BPMJMSFileStore_auto_1'))
 cmo.destroyFileStore(getMBean('/FileStores/BPMJMSFileStore_auto_2'))
 cmo.destroyFileStore(getMBean('/FileStores/BPMJMSFileStore_auto_3'))
 cmo.destroyFileStore(getMBean('/FileStores/BPMJMSFileStore_auto_4'))
 cmo.destroyFileStore(getMBean('/FileStores/SOAJMSFileStore_auto_1'))
 cmo.destroyFileStore(getMBean('/FileStores/SOAJMSFileStore_auto_2'))
 cmo.destroyFileStore(getMBean('/FileStores/SOAJMSFileStore_auto_3'))
 cmo.destroyFileStore(getMBean('/FileStores/SOAJMSFileStore_auto_4'))
 cmo.destroyFileStore(getMBean('/FileStores/FileStore_auto_1'))
 cmo.destroyFileStore(getMBean('/FileStores/FileStore_auto_2'))
 cmo.destroyFileStore(getMBean('/FileStores/FileStore_auto_3'))
 cmo.destroyFileStore(getMBean('/FileStores/FileStore_auto_4'))
if sys.argv[1] == 'StandAlone':
 ############# JDBC stores for STANDALONE ADMINSERVER
 cd('/')
 cmo.createJDBCStore('WseeJaxwsJDBCStore')
 cd('/JDBCStores/WseeJaxwsJDBCStore')
 cmo.setDataSource(getMBean('/SystemResources/EAIJMSDataSource'))
 cmo.setPrefixName('WseeJaxws')
 set('Targets',jarray.array([ObjectName('com.bea:Name=AdminServer,Type=Server')], ObjectName))
 cd('/')
 cmo.createJDBCStore('UMSJMSJDBCStore')
 cd('/JDBCStores/UMSJMSJDBCStore')
 cmo.setDataSource(getMBean('/SystemResources/EAIJMSDataSource'))
 cmo.setPrefixName('UMSJMS')
 set('Targets',jarray.array([ObjectName('com.bea:Name=AdminServer,Type=Server')], ObjectName))
 cd('/')
 cmo.createJDBCStore('SOAJMSJDBCStore')
 cd('/JDBCStores/SOAJMSJDBCStore')
 cmo.setDataSource(getMBean('/SystemResources/EAIJMSDataSource'))
 cmo.setPrefixName('SOAJMS')
 set('Targets',jarray.array([ObjectName('com.bea:Name=AdminServer,Type=Server')], ObjectName))
 cd('/')
 cmo.createJDBCStore('JDBCStore')
 cd('/JDBCStores/JDBCStore')
 cmo.setDataSource(getMBean('/SystemResources/EAIJMSDataSource'))
 cmo.setPrefixName('rmjdbcstore')
 set('Targets',jarray.array([ObjectName('com.bea:Name=AdminServer,Type=Server')], ObjectName))
 cd('/')
 cmo.createJDBCStore('WseeJDBCStore')
 cd('/JDBCStores/WseeJDBCStore')
 cmo.setDataSource(getMBean('/SystemResources/EAIJMSDataSource'))
 cmo.setPrefixName('Wsee')
 set('Targets',jarray.array([ObjectName('com.bea:Name=AdminServer,Type=Server')], ObjectName))
 cd('/')
 cmo.createJDBCStore('BPMJMSJDBCStore')
 cd('/JDBCStores/BPMJMSJDBCStore')
 cmo.setDataSource(getMBean('/SystemResources/EAIJMSDataSource'))
 cmo.setPrefixName('BPMJMS')
 set('Targets',jarray.array([ObjectName('com.bea:Name=AdminServer,Type=Server')], ObjectName))
 #### end of creating jdbc stores
 ############Set Persistent Stores for all the JMS Servers
 cd('/Deployments/WseeJaxwsJmsServer')
 cmo.setPersistentStore(getMBean('/JDBCStores/WseeJaxwsJDBCStore'))

 cd('/Deployments/UMSJMSServer')
 cmo.setPersistentStore(getMBean('/JDBCStores/UMSJMSJDBCStore'))

 cd('/Deployments/BPMJMSServer')
 cmo.setPersistentStore(getMBean('/JDBCStores/BPMJMSJDBCStore'))

 cd('/Deployments/SOAJMSServer')
 cmo.setPersistentStore(getMBean('/JDBCStores/SOAJMSJDBCStore'))

 cd('/Deployments/wlsbJMSServer')
 cmo.setPersistentStore(getMBean('/JDBCStores/JDBCStore'))

 cd('/Deployments/WseeJmsServer')
 cmo.setPersistentStore(getMBean('/JDBCStores/WseeJDBCStore'))
 ##### Set the persistent stores for all SAF agents
 cd('/SAFAgents/ReliableWseeJaxwsSAFAgent')
 cmo.setStore(getMBean('/JDBCStores/WseeJaxwsJDBCStore'))
 cd('/SAFAgents/ReliableWseeSAFAgent')
 cmo.setStore(getMBean('/JDBCStores/WseeJDBCStore'))
 #################DESTROY ALL THE FILE STORES
 cd('/')
 cmo.destroyFileStore(getMBean('/FileStores/WseeJaxwsFileStore'))
 cmo.destroyFileStore(getMBean('/FileStores/UMSJMSFileStore'))
 cmo.destroyFileStore(getMBean('/FileStores/SOAJMSFileStore'))
 cmo.destroyFileStore(getMBean('/FileStores/BPMJMSFileStore'))
 cmo.destroyFileStore(getMBean('/FileStores/WseeFileStore'))
 cmo.destroyFileStore(getMBean('/FileStores/FileStore'))
save()
activate()

Create Custom Identity and Trust Keystore using WLST

#=======================================================================================
# Script to update Keystore
#Author: Lokesh T.C
#=======================================================================================
import sys

print "@@@ Starting the script ..."
from java.util import *
from javax.management import *  
from java.io import FileInputStream
propInputStream1 = FileInputStream("domain.properties")
domainProps = util.Properties()
domainProps.load(propInputStream1)
#The directory of the domain configuration
#/app/oracle/products/11g/admin/domains
wlsDomain=os.environ["WLSDOMAIN"]
print "WLSDOMAIN="+wlsDomain

adminURL='t3://'+domainProps.get('domain1.AdminIP')+':'+domainProps.get('domain1.AdminPort')
adminUserName='weblogic'
adminPassword=domainProps.get("domain1.AdminPasswd")
connect(adminUserName, adminPassword, adminURL)
edit()
startEdit()
if sys.argv[1] == 'Cluster':
 ###################Create KeyStores for cluster####################
 print 'Applying changes to cluster'
 cd('/Servers/AdminServer')
 cmo.setCustomIdentityKeyStoreFileName(wlsDomain+'/certs/appIdentityKeyStore.jks')
 set('CustomIdentityKeyStorePassPhrase', 'welcome1')
 cmo.setCustomTrustKeyStoreFileName(wlsDomain+'/certs/appTrustKeyStore.jks')
 set('CustomTrustKeyStorePassPhrase', 'welcome1')
 cmo.setKeyStores('CustomIdentityAndCustomTrust')
 cmo.setCustomIdentityKeyStoreType('JKS')
 cmo.setCustomTrustKeyStoreType('JKS')
 cd('/Servers/AdminServer/SSL/AdminServer')
 cmo.setServerPrivateKeyAlias(domainProps.get('domain1.cadm-vip1'))
 set('ServerPrivateKeyPassPhrase', 'welcome1')
 cd('/Servers/MS1')
 cmo.setCustomIdentityKeyStoreFileName(wlsDomain+'/certs/appIdentityKeyStore.jks')
 set('CustomIdentityKeyStorePassPhrase', 'welcome1')
 cmo.setCustomTrustKeyStoreFileName(wlsDomain+'/certs/appTrustKeyStore.jks')
 set('CustomTrustKeyStorePassPhrase', 'welcome1')
 cmo.setKeyStores('CustomIdentityAndCustomTrust')
 cmo.setCustomIdentityKeyStoreType('JKS')
 cmo.setCustomTrustKeyStoreType('JKS')
 cd('/Servers/MS1/SSL/MS1')
 cmo.setServerPrivateKeyAlias(domainProps.get('domain1.ms-vip1'))
 set('ServerPrivateKeyPassPhrase', 'welcome1')
 cd('/Servers/MS2')
 cmo.setCustomIdentityKeyStoreFileName(wlsDomain+'/certs/appIdentityKeyStore.jks')
 set('CustomIdentityKeyStorePassPhrase', 'welcome1')
 cmo.setCustomTrustKeyStoreFileName(wlsDomain+'/certs/appTrustKeyStore.jks')
 set('CustomTrustKeyStorePassPhrase', 'welcome1')
 cmo.setKeyStores('CustomIdentityAndCustomTrust')
 cmo.setCustomIdentityKeyStoreType('JKS')
 cmo.setCustomTrustKeyStoreType('JKS')
 cd('/Servers/MS2/SSL/MS2')
 cmo.setServerPrivateKeyAlias(domainProps.get('domain1.ms-vip2'))
 set('ServerPrivateKeyPassPhrase', 'welcome1')
 cd('/Servers/MS3')
 cmo.setCustomIdentityKeyStoreFileName(wlsDomain+'/certs/appIdentityKeyStore.jks')
 set('CustomIdentityKeyStorePassPhrase', 'welcome1')
 cmo.setCustomTrustKeyStoreFileName(wlsDomain+'/certs/appTrustKeyStore.jks')
 set('CustomTrustKeyStorePassPhrase', 'welcome1')
 cmo.setKeyStores('CustomIdentityAndCustomTrust')
 cmo.setCustomIdentityKeyStoreType('JKS')
 cmo.setCustomTrustKeyStoreType('JKS')
 cd('/Servers/MS3/SSL/MS3')
 cmo.setServerPrivateKeyAlias(domainProps.get('domain1.ms-vip3'))
 set('ServerPrivateKeyPassPhrase', 'welcome1')
 cd('/Servers/MS4')
 cmo.setCustomIdentityKeyStoreFileName(wlsDomain+'/certs/appIdentityKeyStore.jks')
 set('CustomIdentityKeyStorePassPhrase', 'welcome1')
 cmo.setCustomTrustKeyStoreFileName(wlsDomain+'/certs/appTrustKeyStore.jks')
 set('CustomTrustKeyStorePassPhrase', 'welcome1')
 cmo.setKeyStores('CustomIdentityAndCustomTrust')
 cmo.setCustomIdentityKeyStoreType('JKS')
 cmo.setCustomTrustKeyStoreType('JKS')
 cd('/Servers/MS4/SSL/MS4')
 cmo.setServerPrivateKeyAlias(domainProps.get('domain1.ms-vip4'))
 set('ServerPrivateKeyPassPhrase', 'welcome1')
 cd('/Servers/SOA1')
 cmo.setCustomIdentityKeyStoreFileName(wlsDomain+'/certs/appIdentityKeyStore.jks')
 set('CustomIdentityKeyStorePassPhrase', 'welcome1')
 cmo.setCustomTrustKeyStoreFileName(wlsDomain+'/certs/appTrustKeyStore.jks')
 set('CustomTrustKeyStorePassPhrase', 'welcome1')
 cmo.setKeyStores('CustomIdentityAndCustomTrust')
 cmo.setCustomIdentityKeyStoreType('JKS')
 cmo.setCustomTrustKeyStoreType('JKS')
 cd('/Servers/SOA1/SSL/SOA1')
 cmo.setServerPrivateKeyAlias(domainProps.get('domain1.soac-vip1'))
 set('ServerPrivateKeyPassPhrase', 'welcome1')
 cd('/Servers/SOA2')
 cmo.setCustomIdentityKeyStoreFileName(wlsDomain+'/certs/appIdentityKeyStore.jks')
 set('CustomIdentityKeyStorePassPhrase', 'welcome1')
 cmo.setCustomTrustKeyStoreFileName(wlsDomain+'/certs/appTrustKeyStore.jks')
 set('CustomTrustKeyStorePassPhrase', 'welcome1')
 cmo.setKeyStores('CustomIdentityAndCustomTrust')
 cmo.setCustomIdentityKeyStoreType('JKS')
 cmo.setCustomTrustKeyStoreType('JKS')
 cd('/Servers/SOA2/SSL/SOA2')
 cmo.setServerPrivateKeyAlias(domainProps.get('domain1.soac-vip2'))
 set('ServerPrivateKeyPassPhrase', 'welcome1')
 cd('/Servers/SOA3')
 cmo.setCustomIdentityKeyStoreFileName(wlsDomain+'/certs/appIdentityKeyStore.jks')
 set('CustomIdentityKeyStorePassPhrase', 'welcome1')
 cmo.setCustomTrustKeyStoreFileName(wlsDomain+'/certs/appTrustKeyStore.jks')
 set('CustomTrustKeyStorePassPhrase', 'welcome1')
 cmo.setKeyStores('CustomIdentityAndCustomTrust')
 cmo.setCustomIdentityKeyStoreType('JKS')
 cmo.setCustomTrustKeyStoreType('JKS')
 cd('/Servers/SOA3/SSL/SOA3')
 cmo.setServerPrivateKeyAlias(domainProps.get('domain1.soac-vip3'))
 set('ServerPrivateKeyPassPhrase', 'welcome1')
 cd('/Servers/SOA4')
 cmo.setCustomIdentityKeyStoreFileName(wlsDomain+'/certs/appIdentityKeyStore.jks')
 set('CustomIdentityKeyStorePassPhrase', 'welcome1')
 cmo.setCustomTrustKeyStoreFileName(wlsDomain+'/certs/appTrustKeyStore.jks')
 set('CustomTrustKeyStorePassPhrase', 'welcome1')
 cmo.setKeyStores('CustomIdentityAndCustomTrust')
 cmo.setCustomIdentityKeyStoreType('JKS')
 cmo.setCustomTrustKeyStoreType('JKS')
 cd('/Servers/SOA4/SSL/SOA4')
 cmo.setServerPrivateKeyAlias(domainProps.get('domain1.soac-vip4'))
 set('ServerPrivateKeyPassPhrase', 'welcome1')
 cd('/Servers/OSB1')
 cmo.setCustomIdentityKeyStoreFileName(wlsDomain+'/certs/appIdentityKeyStore.jks')
 set('CustomIdentityKeyStorePassPhrase', 'welcome1')
 cmo.setCustomTrustKeyStoreFileName(wlsDomain+'/certs/appTrustKeyStore.jks')
 set('CustomTrustKeyStorePassPhrase', 'welcome1')
 cmo.setKeyStores('CustomIdentityAndCustomTrust')
 cmo.setCustomIdentityKeyStoreType('JKS')
 cmo.setCustomTrustKeyStoreType('JKS')
 cd('/Servers/OSB1/SSL/OSB1')
 cmo.setServerPrivateKeyAlias(domainProps.get('domain1.osb-vip1'))
 set('ServerPrivateKeyPassPhrase', 'welcome1')
 cd('/Servers/OSB2')
 cmo.setCustomIdentityKeyStoreFileName(wlsDomain+'/certs/appIdentityKeyStore.jks')
 set('CustomIdentityKeyStorePassPhrase', 'welcome1')
 cmo.setCustomTrustKeyStoreFileName(wlsDomain+'/certs/appTrustKeyStore.jks')
 set('CustomTrustKeyStorePassPhrase', 'welcome1')
 cmo.setKeyStores('CustomIdentityAndCustomTrust')
 cmo.setCustomIdentityKeyStoreType('JKS')
 cmo.setCustomTrustKeyStoreType('JKS')
 cd('/Servers/OSB2/SSL/OSB2')
 cmo.setServerPrivateKeyAlias(domainProps.get('domain1.osb-vip2'))
 set('ServerPrivateKeyPassPhrase', 'welcome1')
 cd('/Servers/OSB3')
 cmo.setCustomIdentityKeyStoreFileName(wlsDomain+'/certs/appIdentityKeyStore.jks')
 set('CustomIdentityKeyStorePassPhrase', 'welcome1')
 cmo.setCustomTrustKeyStoreFileName(wlsDomain+'/certs/appTrustKeyStore.jks')
 set('CustomTrustKeyStorePassPhrase', 'welcome1')
 cmo.setKeyStores('CustomIdentityAndCustomTrust')
 cmo.setCustomIdentityKeyStoreType('JKS')
 cmo.setCustomTrustKeyStoreType('JKS')
 cd('/Servers/OSB3/SSL/OSB3')
 cmo.setServerPrivateKeyAlias(domainProps.get('domain1.osb-vip3'))
 set('ServerPrivateKeyPassPhrase', 'welcome1')
 cd('/Servers/OSB4')
 cmo.setCustomIdentityKeyStoreFileName(wlsDomain+'/certs/appIdentityKeyStore.jks')
 set('CustomIdentityKeyStorePassPhrase', 'welcome1')
 cmo.setCustomTrustKeyStoreFileName(wlsDomain+'/certs/appTrustKeyStore.jks')
 set('CustomTrustKeyStorePassPhrase', 'welcome1')
 cmo.setKeyStores('CustomIdentityAndCustomTrust')
 cmo.setCustomIdentityKeyStoreType('JKS')
 cmo.setCustomTrustKeyStoreType('JKS')
 cd('/Servers/OSB4/SSL/OSB4')
 cmo.setServerPrivateKeyAlias(domainProps.get('domain1.osb-vip4'))
 set('ServerPrivateKeyPassPhrase', 'welcome1')

if sys.argv[1] == 'StandAlone':
 ############# JDBC stores for STANDALONE ADMINSERVER
 cd('/Servers/AdminServer')
 cmo.setCustomIdentityKeyStoreFileName(wlsDomain+'/certs/appIdentityKeyStore.jks')
 set('CustomIdentityKeyStorePassPhrase', 'welcome1')
 cmo.setCustomTrustKeyStoreFileName(wlsDomain+'/certs/appTrustKeyStore.jks')
 set('CustomTrustKeyStorePassPhrase', 'welcome1')
 cmo.setKeyStores('CustomIdentityAndCustomTrust')
 cmo.setCustomIdentityKeyStoreType('JKS')
 cmo.setCustomTrustKeyStoreType('JKS')
 cd('/Servers/AdminServer/SSL/AdminServer')
 cmo.setServerPrivateKeyAlias(domainProps.get('domain1.cadm-vip1'))
 set('ServerPrivateKeyPassPhrase', 'welcome1')
save()
activate()

Script to Fix Bug in weblogic Script for production mode and default keystore setting

As everyone know weblogic uses a default Trust Key Store hardcoded in the setDomainEnv.sh file so irrespective of changes in the console for each of the managed servers the server still used to refer to the harded keystore path.

Just similar to keystore, when manadged domain folder was separted out of adminserver, there was no option to either set mode to production and neither the script used to replicate it

So I had to write my shell script to fix weblogic bug and its worth chasing with ORACLE.

# *****************************************************************************************
# find_and_replace_in_files.sh
# This script does a recursive, case sensitive directory search and replace text from the files
# To make a case insensitive search replace, use the -i switch in the grep call
# *****************************************************************************************
!/bin/bash
# **************** Change Variables Here ************
echo $startdirectory
searchterm='PRODUCTION_MODE=""'
replaceterm='PRODUCTION_MODE="true"'
searchterm1='-Djavax.net.ssl.trustStore=\${WL_HOME}/server/lib/DemoTrust.jks'
searchtermfinal="`echo $searchterm1 | sed 's:\.:\\\.:g'`"
searchtermfinal="`echo $searchtermfinal | sed 's:\/:\\\/:g'`"
echo $searchterm1
echo $searchtermfinal
replaceterm1='-Djavax.net.ssl.trustStore='
replaceterm2='/certs/appTrustKeyStore.jks -Djavax.net.ssl.trustStorePassword=welcome1'
replaceterm3=$replaceterm1$WLSDOMAIN$replaceterm2
echo $replaceterm3
replacetermfinal="`echo $replaceterm3 | sed 's:\.:\\\.:g'`"
echo $replacetermfinal

replacetermfinal="`echo $replacetermfinal | sed 's:\/:\\\/:g'`"
echo $replacetermfinal
# **********************************************************
echo "******************************************"
echo "* Search and Replace in Files Version .1 *"
echo "******************************************"
find $MWHOME/admin/SOACoreDomain/mserver/SOACoreDomain/bin/setDomainEnv.sh -type f | xargs perl -pi -e s/$searchterm/$replaceterm/g
if [ -d "$MWHOME/admin/SOAExtDomain/mserver/SOAExtDomain/bin" ]; then
 find $MWHOME/admin/SOAExtDomain/mserver/SOAExtDomain/bin/setDomainEnv.sh -type f | xargs perl -pi -e s/$searchterm/$replaceterm/g
fi
if [ -d "$MWHOME/admin/SOACoreDomain/mserver/SOACoreDomain/bin" ]; then
echo "Replacinig values for SOACoreDomain"
 replacetermfinal1=`echo  "find $MWHOME/admin/SOACoreDomain/mserver/SOACoreDomain/bin/setDomainEnv.sh -type f | xargs perl -pi -e 's/$searchtermfinal/$replacetermfinal/g'"`
 echo $replacetermfinal1
 eval $replacetermfinal1
echo "Replacinig values for SOAExtDomain"
 replacetermfinal1=`echo  "find $MWHOME/admin/SOAExtDomain/mserver/SOAExtDomain/bin/setDomainEnv.sh -type f | xargs perl -pi -e 's/$searchtermfinal/$replacetermfinal/g'"`
 echo $replacetermfinal1
 eval $replacetermfinal1
fi
if [ -d "$WLSDOMAIN/SOAExtDomain/aserver/SOAExtDomain/bin" ]; then
echo "Replacinig values for SOAExtDomain AdminServer"
 replacetermfinal1=`echo  "find $WLSDOMAIN/SOAExtDomain/aserver/SOAExtDomain/bin/setDomainEnv.sh -type f | xargs perl -pi -e 's/$searchtermfinal/$replacetermfinal/g'"`
 echo $replacetermfinal1
 eval $replacetermfinal1
fi
if [ -d "$WLSDOMAIN/SOACoreDomain/aserver/SOACoreDomain/bin" ]; then
echo "Replacinig values for SOACoreDomain Adminserver"
 replacetermfinal1=`echo  "find $WLSDOMAIN/SOACoreDomain/aserver/SOACoreDomain/bin/setDomainEnv.sh -type f | xargs perl -pi -e 's/$searchtermfinal/$replacetermfinal/g'"`
 echo $replacetermfinal1
 eval $replacetermfinal1
fi
echo " *** All Done! *** "