Showing posts with label WLST. Show all posts
Showing posts with label WLST. Show all posts

Thursday, May 7, 2020

Troubleshooting: Installation and Configurations of FMW

Issue#1: CFGFWK-60324: Location is not a directory

Domain Configuration time issue


Solution:


Check the domain path which you enter already in use or correct one.

Issue #2: some system prerequisites failed



Extracting the installer . . . . . . . . . . . . . . . . . . Done
Checking if CPU speed is above 300 MHz.   Actual 2194.910 MHz    Passed
Checking swap space: must be greater than 512 MB.   Actual 0 MB    Failed <<<<
Checking if this platform requires a 64-bit JVM.   Actual 64    Passed (64-bit not required)
Checking temp space: must be greater than 300 MB.   Actual 11624 MB    Passed

Some system prerequisite checks failed.
You must fulfill these requirements before continuing.
The log is located here: /tmp/OraInstall2020-05-06_11-54-32PM/launcher2020-05-06_11-54-32PM.log.

To Fix this simple you look in to the above output, what check it got failed that is shown with "Failed <<<<" Just use at the end -ignoreSysPrereqs
   java -jar  /u02/fmw_12.2.1.3.0_infrastructure.jar -silent -responseFile /u02/fmw12213_infra.rsp -invPtrLoc /u02/oraInst.loc -ignoreSysPrereqs

Issue: the error message: java.io.IOException: Error writing to server

Navigate to bitools 
cd /opt/domains/bi_domain/bitools/bin
$ ./datamodel.sh uploadrpd -I /tmp/TEMPDIR/new_rpd/Sample.rpd -W MyRPDPassword \
-u weblogic -SI ssi -s localhost
Password:
Post uploadrpd REST with url: http://localhost:9502/api/lcm/v1/si/ssi/rpd/uploadrpd
Please check server logs, such as bi-lcm-rest.log.0 and obis1-diagnostic.log.. or refer to the error message: java.io.IOException: Error writing to server

Fix:
Check whether your bi_domain or OAS domain have the internal SSL enabled if yes, you can handle it two choices:
1. Create Keystore type as  KSS trust store and trust password
2. Disable the SSL from the bi_domain


  ./stop.sh
  ./start.sh
  ./status.sh
  
  ./ssl.sh internalssl false 
  
Now try the RPD deployment.

ODI Studio issue: 

Caused by: org.osgi.framework.BundleException: Exception in org.eclipse.osgi.framework.internal.core.SystemBundleActivator.start() of bundle org.eclipse.osgi.

The fix is here: 
In UNIX/Linux machine: Navigate to $HOME/.odi directory (.odi is a hidden directory).
Delete the "system<ODI version>" folder, with <ODI version> corresponding to your version of ODI, using:
rm -rf system ODIversion e.g ystem12.2.1.3.0
No worry it is just a cache folder

For example, for ODI 12.2.1.3.0, delete "system12.2.1.3.0".
 
Now you can restart ODI Studio by running 

cd $ODI_HOME/studio; ./odi.sh

A new folder system<ODI version> will be created in the home directory.

ODI-1424: Agent host or port cannot be reached

Issue: <ODI-2013> <Ping to agent OracleDIAgent failed with "oracle.odi.runtime.agent.invocation.InvocationException: 
ODI-1424: Agent host or port cannot be reached using

Fix: 
  1. Open the Oracle Data Integrator Studio (odi.sh in the Linux from VNC Viewer) In the left pane : Navigate to Topology >> Agent> oraclediagent
  2. Now check the WebLogic managed server connecting host, port values entered correctly or not if there is mismatch then update it. 
  3. Validate by Test Connection

Issue : CFGFWK-64062: Invalid Template - Parsing The Config-nodemanager.xml Failed!

After upgrade of the domain from FMW 12.1.3 to FMW 12.2.1 in place upgrade completed but the domain remains in the same old FWM installed path. 
To resolve this I've used following steps:
1. Using Configbuilder tool to create mydomain_template.jar 
2. Using config.sh that is configuraiton wizard created domain using 'Custom template" that was created in step 1. 
 
But it got the issue with reading domain template saying that " in loading config-nodemanager.xml file"
Solution:
As a workaound, remove the config-nodemanager.xml file from the generated template jar, then use that template to create a new domain.
 mkdir temp_jar; cd temp_jar # copy template jar here
  jar xvf mydomain_template.jar
  rm config-nodemanager.xml mydomain_template.jar
  jar cvf mydomain_template.jar ./* 
  

Issue boot properties not found for a managed server

If the managed server unable to start when there is no boot.properties found then it get failed to start. Solution: As a workaround for copy the security folder from the AdminServer copy to the managed server folder.
cp ../servers/AdminServer/security ../servers/ODI_server1/ -r
  ls -l ../servers/ODI_server1/
  

How to get the RCU DB Schema Password using WLST?

This is simple execute the $MW_HOME/oracle_common/common/bin/wlst.sh script to enter into WLST  shell. 

Simple 3 steps you need to perform.
  1. get the domain path into a variable 'domain'
  2. using the domain get the service
  3. Using the Weblogic security library run the decrypt function on service
  4. finally, print the clear text password

 domain = "/opt/12.1.3_odi_home/user_projects/domains/base_domain"
 service = weblogic.security.internal.SerializedSystemIni.getEncryptionService(domain)
 encryption = weblogic.security.internal.encryption.ClearOrEncryptedService(service)
 print encryption.decrypt("{AES}ysA9HONq3bVSNMvndUg2zLTnMkn93NQC6kk2BJDOC5g=")
 exit()
Note: The encrypted line picked from the WebLogic config.xml file.
WLST Decrypt

Friday, February 14, 2020

Create OHS Domain (Standalone) using WLST

Hello, Oracle Fusion product fans!! In this series of Oracle Fusion technical learning, I would like to share the latest experiment on OHS domain creation using WLST. It's a situation where I've installed OHS Standalone on a Vagrant based CentOS VirtualBox and need to run the OHS instance. I've searched on Google and also in Oracle but there is no such simple code or step that will work without X11 forwarding. Got a thought, There could be similar requirements may be there in a docker container as well. Searched in Github about OHS image creation code there I've learnt how does this WLST help us to create the OHS domain and creates ohs1 component instance within it.

Create OHS Domain standalone mode using WLST script


The magical WLST script looks like this...

#!/usr/bin/python
# Create OHS Domain standalone mode with 'ohs1' as system Component
# Created date  : 12-02-2020

import os, sys

def read_ohsdomain_template():
    """ Select and load the template 
        To create ohs domain
    """
    setTopologyProfile('Compact')
    selectTemplate('Oracle HTTP Server (Standalone)')
    loadTemplates()
    showTemplates()
    
def set_ohsdomain():
    """
    Create OHS System Component by the name ohs1, 
    Configure OHS Listen Port and SSL Port
    """
    cd('/')
    cd('SystemComponent/' + ohs_comp_name)
    set('ComponentType','OHS')
    cd('/')
    cd('OHS/' + ohs_comp_name)
    set('ListenAddress','')
    set('ListenPort', ohs_http_port)
    set('SSLListenPort', ohs_ssl_port)

def set_ohs_nm():
    """
    Set NodeManager user name and password
    """
    cd('/')
    create('sc', 'SecurityConfiguration')
    cd('SecurityConfiguration/sc')
    set('NodeManagerUsername', username)
    set('NodeManagerPasswordEncrypted', password)
    setOption('NodeManagerType','PerDomainNodeManager')
    setOption('OverwriteDomain', 'true')

# Main program Write Domain, close template and exit
if __name__== "main":
    read_ohsdomain_template()
    set_ohsdomain()
    set_ohs_nm()
    writeDomain(domain_path)
    dumpStack()
    closeTemplate()
    exit()
Sample properties file use your favourite editor and create it
nano ohssa_domain.properties

ohs_http_port = 7777
ohs_ssl_port  = 7733
ohs_comp_name = ohs1
domain_name = ohsDomain
domain_path = /u01/app/oracle/fmw/domains
username = weblogic
password = welcome1

Executing this WLST Script is one more trick you need to play!! Navigate to the OHS installed location and then, use the oracle_common/common/bin/wlst.sh to run the above WLST script 'create_ohsdomain.py'.
OHS_HOME-/u01/app/oracle/fmw/ohs
$OHS_HOME/oracle_common/common/bin/wlst.sh -loadProperties ohssa_domain.properties create_ohsdomain.py

ohsDomain directory structure

Add a line to your export lines in your .bash_profile script
export OHS_DOMAIN=/u01/app/oracle/fmw/domains/ohsDomain

and run the .bash_profile script. Now all set to start the OHS NodeManager and then start the ohs1 component from the $OHS_DOMAIN/bin path.

startComponent ohs1

Now open a browser, access the OHS url: http://192.168.33.120:7777

Acessing OHS Console


Hope this wonderful experiment gives you fun and enjoy!! Write your valuable feedback and keep encouraging to see more automation scripts...

Keep sharing with your friends and technical enthusiasts

Wednesday, January 29, 2020

Creating SOA domain using WLST

Hello, Oracle products fans!! This post I would like to dedicate to all who are interested to grow with the automation skills and part of paradigm shift from on-prem to Cloud platforms. There is lots of need in the various Oracle cloud platforms where internally uses Python scripting that is, WLST automation are base for building the Enterprise level architecture.

Prerequisite for SOA domain 

To run the script you must have
Please read all parameters which are used in this WLST script and do changes as per your project requirements.


Oracle SOA Domain using WLST




Create a below create_soa_domain.py file and place in any location on your machine where you can run WLST

WLHOME      = ORACLE_HOME+'/wlserver'
ORACLE_HOME = '/home/oracle/products/12.2.1/Oracle_Home'
DOMAIN      = 'soa_domain'
DOMAIN_PATH = '/home/oracle/wls_domains/domains/soa_domain'
APP_PATH    = '/home/oracle/wls_domains/applications/soa_domain'

SERVER_ADDRESS = '192.168.33.100'
LOG_FOLDER     = '/var/log/weblogic/'

JSSE_ENABLED     = true
DEVELOPMENT_MODE = true
WEBTIER_ENABLED  = true

ADMIN_SERVER   = 'AdminServer'
ADMIN_USER     = 'weblogic'
ADMIN_PASSWORD = 'weblogic1'

JAVA_HOME      = '/home/oracle/jdk1.8.0_65'

ADM_JAVA_ARGUMENTS = '-XX:PermSize=256m -XX:MaxPermSize=512m -Xms1024m -Xmx1532m -Dweblogic.Stdout='+LOG_FOLDER+'AdminServer.out -Dweblogic.Stderr='+LOG_FOLDER+'AdminServer_err.out'
OSB_JAVA_ARGUMENTS = '-XX:PermSize=256m -XX:MaxPermSize=512m -Xms1024m -Xmx1024m '
SOA_JAVA_ARGUMENTS = '-XX:PermSize=256m -XX:MaxPermSize=752m -Xms1024m -Xmx1532m '
BAM_JAVA_ARGUMENTS = '-XX:PermSize=256m -XX:MaxPermSize=512m -Xms1024m -Xmx1532m '


SOA_REPOS_DBURL          = 'jdbc:oracle:thin:@192.168.33.115:1521/orcl'
SOA_REPOS_DBUSER_PREFIX  = 'DEV'
SOA_REPOS_DBPASSWORD     = 'welcome1'

BPM_ENABLED=false
BAM_ENABLED=true
B2B_ENABLED=true
ESS_ENABLED=true

def createBootPropertiesFile(directoryPath,fileName, username, password):
  serverDir = File(directoryPath)
  bool = serverDir.mkdirs()
  fileNew=open(directoryPath + '/'+fileName, '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()

def changeDatasourceToXA(datasource):
  print 'Change datasource '+datasource
  cd('/')
  cd('/JDBCSystemResource/'+datasource+'/JdbcResource/'+datasource+'/JDBCDriverParams/NO_NAME_0')
  set('DriverName','oracle.jdbc.xa.client.OracleXADataSource')
  set('UseXADataSourceInterface','True') 
  cd('/JDBCSystemResource/'+datasource+'/JdbcResource/'+datasource+'/JDBCDataSourceParams/NO_NAME_0')
  set('GlobalTransactionsProtocol','TwoPhaseCommit')
  cd('/')

def changeManagedServer(server,port,java_arguments):
  cd('/Servers/'+server)
  set('Machine'      ,'LocalMachine')
  set('ListenAddress',SERVER_ADDRESS)
  set('ListenPort'   ,port)

  create(server,'ServerStart')
  cd('ServerStart/'+server)
  set('Arguments' , java_arguments+' -Dweblogic.Stdout='+LOG_FOLDER+server+'.out -Dweblogic.Stderr='+LOG_FOLDER+server+'_err.out')
  set('JavaVendor','Sun')
  set('JavaHome'  , JAVA_HOME)

  cd('/Server/'+server)
  create(server,'SSL')
  cd('SSL/'+server)
  set('Enabled'                    , 'False')
  set('HostNameVerificationIgnored', 'True')

  if JSSE_ENABLED == true:
    set('JSSEEnabled','True')
  else:
    set('JSSEEnabled','False')  

  cd('/Server/'+server)
  create(server,'Log')
  cd('/Server/'+server+'/Log/'+server)
  set('FileName'     , LOG_FOLDER+server+'.log')
  set('FileCount'    , 10)
  set('FileMinSize'  , 5000)
  set('RotationType' ,'byTime')
  set('FileTimeSpan' , 24)

print('Start...wls domain with template /home/oracle/products/12.2.1/Oracle_Home/wlserver/common/templates/wls/wls.jar')
readTemplate(ORACLE_HOME+'/wlserver/common/templates/wls/wls.jar')


cd('/')

print('Set domain log')
create('base_domain','Log')

cd('/Log/base_domain')
set('FileName'    ,LOG_FOLDER+DOMAIN+'.log')
set('FileCount'   ,10)
set('FileMinSize' ,5000)
set('RotationType','byTime')
set('FileTimeSpan',24)

cd('/Servers/AdminServer')
# name of adminserver
set('Name',ADMIN_SERVER )

cd('/Servers/'+ADMIN_SERVER)

# address and port
set('ListenAddress',SERVER_ADDRESS)
set('ListenPort'   ,7001)

setOption( "AppDir", APP_PATH )

create(ADMIN_SERVER,'ServerStart')
cd('ServerStart/'+ADMIN_SERVER)
set('Arguments' , ADM_JAVA_ARGUMENTS)
set('JavaVendor','Sun')
set('JavaHome'  , JAVA_HOME)

cd('/Server/'+ADMIN_SERVER)
create(ADMIN_SERVER,'SSL')
cd('SSL/'+ADMIN_SERVER)
set('Enabled'                    , 'False')
set('HostNameVerificationIgnored', 'True')

if JSSE_ENABLED == true:
  set('JSSEEnabled','True')
else:
  set('JSSEEnabled','False')


cd('/Server/'+ADMIN_SERVER)

create(ADMIN_SERVER,'Log')
cd('/Server/'+ADMIN_SERVER+'/Log/'+ADMIN_SERVER)
set('FileName'    ,LOG_FOLDER+ADMIN_SERVER+'.log')
set('FileCount'   ,10)
set('FileMinSize' ,5000)
set('RotationType','byTime')
set('FileTimeSpan',24)

print('Set password...')
cd('/')
cd('Security/base_domain/User/weblogic')

# weblogic user name + password
set('Name',ADMIN_USER)
cmo.setPassword(ADMIN_PASSWORD)

if DEVELOPMENT_MODE == true:
  setOption('ServerStartMode', 'dev')
else:
  setOption('ServerStartMode', 'prod')

setOption('JavaHome', JAVA_HOME)

print('write domain...')
# write path + domain name
writeDomain(DOMAIN_PATH)
closeTemplate()

createAdminStartupPropertiesFile(DOMAIN_PATH+'/servers/'+ADMIN_SERVER+'/data/nodemanager',ADM_JAVA_ARGUMENTS)
createBootPropertiesFile(DOMAIN_PATH+'/servers/'+ADMIN_SERVER+'/security','boot.properties',ADMIN_USER,ADMIN_PASSWORD)
createBootPropertiesFile(DOMAIN_PATH+'/config/nodemanager','nm_password.properties',ADMIN_USER,ADMIN_PASSWORD)

es = encrypt(ADMIN_PASSWORD,DOMAIN_PATH)
readDomain(DOMAIN_PATH)

print('set domain password...') 
cd('/SecurityConfiguration/'+DOMAIN)
set('CredentialEncrypted',es)

print('Set nodemanager password')
set('NodeManagerUsername'         ,ADMIN_USER )
set('NodeManagerPasswordEncrypted',es )

cd('/')
setOption( "AppDir", APP_PATH )
print('Extend...osb domain with template /home/oracle/products/12.2.1/Oracle_Home/osb/common/templates/wls/oracle.osb_template.jar')
addTemplate(ORACLE_HOME+'/oracle_common/common/templates/wls/oracle.wls-webservice-template.jar')
addTemplate(ORACLE_HOME+'/osb/common/templates/wls/oracle.osb_template.jar')

print 'Adding ApplCore Template'
addTemplate(ORACLE_HOME+'/oracle_common/common/templates/wls/oracle.applcore.model.stub_template.jar')

print 'Adding SOA Template'
addTemplate(ORACLE_HOME+'/soa/common/templates/wls/oracle.soa_template.jar')

if BAM_ENABLED == true:
  print 'Adding BAM Template'
  addTemplate(ORACLE_HOME+'/soa/common/templates/wls/oracle.bam.server_template.jar')

if BPM_ENABLED == true:
  print 'Adding BPM Template'
  addTemplate(ORACLE_HOME+'/soa/common/templates/wls/oracle.bpm_template_12.1.3.jar')
  
if WEBTIER_ENABLED == true:
  print 'Adding OHS Template'
  addTemplate(ORACLE_HOME+'/ohs/common/templates/wls/ohs_managed_template.jar')

if B2B_ENABLED == true:
  print 'Adding B2B Template'
  addTemplate(ORACLE_HOME+'/soa/common/templates/wls/oracle.soa.b2b_template.jar')

if ESS_ENABLED == true:
  print 'Adding ESS Template'
  addTemplate(ORACLE_HOME+'/oracle_common/common/templates/wls/oracle.ess.basic_template.jar')
  
  

  addTemplate(ORACLE_HOME+'/em/common/templates/wls/oracle.em_ess_template.jar')
   

dumpStack()

print 'Change datasources'

print 'Change datasource LocalScvTblDataSource'
cd('/JDBCSystemResource/LocalSvcTblDataSource/JdbcResource/LocalSvcTblDataSource/JDBCDriverParams/NO_NAME_0')
set('URL',SOA_REPOS_DBURL)
set('PasswordEncrypted',SOA_REPOS_DBPASSWORD)
cd('Properties/NO_NAME_0/Property/user')
set('Value',SOA_REPOS_DBUSER_PREFIX+'_STB')

print 'Call getDatabaseDefaults which reads the service table'
getDatabaseDefaults()    

changeDatasourceToXA('EDNDataSource')
changeDatasourceToXA('wlsbjmsrpDataSource')
changeDatasourceToXA('OraSDPMDataSource')
changeDatasourceToXA('SOADataSource')

if BAM_ENABLED == true:
  changeDatasourceToXA('BamDataSource')

print 'end datasources'


print('Create machine LocalMachine with type UnixMachine')
cd('/')
create('LocalMachine','UnixMachine')
cd('UnixMachine/LocalMachine')
create('LocalMachine','NodeManager')
cd('NodeManager/LocalMachine')
set('ListenAddress',SERVER_ADDRESS)

print 'Change AdminServer'
cd('/Servers/'+ADMIN_SERVER)
set('Machine','LocalMachine')

print 'change soa_server1'
cd('/')
changeManagedServer('soa_server1',8001,SOA_JAVA_ARGUMENTS)

if BAM_ENABLED == true:
  print 'change bam_server1'
  cd('/')
  changeManagedServer('bam_server1',9001,BAM_JAVA_ARGUMENTS)

print 'change osb_server1'
cd('/')
changeManagedServer('osb_server1',8011,OSB_JAVA_ARGUMENTS)

print 'Add server groups WSM-CACHE-SVR WSMPM-MAN-SVR JRF-MAN-SVR to AdminServer'
serverGroup = ["WSM-CACHE-SVR" , "WSMPM-MAN-SVR" , "JRF-MAN-SVR"]
setServerGroups(ADMIN_SERVER, serverGroup)                      

if ESS_ENABLED == true:
  print 'Add server group SOA-MGD-SVRS,ESS-MGD-SVRS to soa_server1'
  cd('/')
  delete('ess_server1', 'Server')
  serverGroup = ["SOA-MGD-SVRS","ESS-MGD-SVRS"]
else:
  print 'Add server group SOA-MGD-SVRS to soa_server1'
  serverGroup = ["SOA-MGD-SVRS"]

setServerGroups('soa_server1', serverGroup)                      

if BAM_ENABLED == true:
  print 'Add server group BAM12-MGD-SVRS to bam_server1'
  serverGroup = ["BAM12-MGD-SVRS"]
  setServerGroups('bam_server1', serverGroup)                      

print 'Add server group OSB-MGD-SVRS-COMBINED to osb_server1'
serverGroup = ["OSB-MGD-SVRS-COMBINED"]
setServerGroups('osb_server1', serverGroup)                      

print 'end server groups'

updateDomain()
closeDomain();

createBootPropertiesFile(DOMAIN_PATH+'/servers/soa_server1/security','boot.properties',ADMIN_USER,ADMIN_PASSWORD)

if BAM_ENABLED == true:
  createBootPropertiesFile(DOMAIN_PATH+'/servers/bam_server1/security','boot.properties',ADMIN_USER,ADMIN_PASSWORD)

createBootPropertiesFile(DOMAIN_PATH+'/servers/osb_server1/security','boot.properties',ADMIN_USER,ADMIN_PASSWORD)

print('Exiting SOA Domain creation completed ...')
exit()
Run the below command to complete the domain creation

wlst create_soa_domain.py



Write back your experiment success stories, Issues if you faced in the journey of automation,
That's it for now!! Happy Coding, Have A Happy Learning

Tuesday, January 12, 2016

SOA 12.2.1 Clustered Domain Using WLST Script

Hey!

Namaste from Oracle Fusion Middleware world!! In this post, I would like to share the experiment on the SOA domain using WLST for a high availability imposed Clustered Domain.

Prerequisites for SOA cluster domain configuration



  1. Oracle Fusion Middleware Infrastructure
  2. Oracle SOA 12.2.1 Installation
  3. Oracle OSB 12.2.1 Installation

Clustered SOA Domain using WLST preparation

High availability can be achived when we configured multiple WebLgoic managed servers and they are part of a cluster. Here in this case 'soa_server1', 'soa_server2' are configured into the 'soa_cluster'.

Step 1: Create the below soa_domain.properties file
WLHOME      = /home/oracle/products/12.2.1/Oracle_Home/wlserver
ORACLE_HOME = /home/oracle/products/12.2.1/Oracle_Home
DOMAIN      = soa_qa_domain
DOMAIN_PATH = /home/oracle/wls_domains/domains/soa_qa_domain
APP_PATH    = /home/oracle/wls_domains/applications/soa_qa_domain
 
SERVER_ADDRESS = 192.168.xxx.xxx
LOG_FOLDER     = /var/log/weblogic/
 
JSSE_ENABLED     = true
DEVELOPMENT_MODE = true
WEBTIER_ENABLED  = false
 
ADMIN_SERVER   = AdminServer
ADMIN_USER     = weblogic
ADMIN_PASSWORD = weblogic1
 
JAVA_HOME      = /home/oracle/jdk1.8.0_65
 
ADM_JAVA_ARGUMENTS = -XX:PermSize=256m -XX:MaxPermSize=512m -Xms1024m -Xmx1532m 
OSB_JAVA_ARGUMENTS = -XX:PermSize=256m -XX:MaxPermSize=512m -Xms1024m -Xmx1024m 
SOA_JAVA_ARGUMENTS = -XX:PermSize=256m -XX:MaxPermSize=752m -Xms1024m -Xmx1532m 
BAM_JAVA_ARGUMENTS = -XX:PermSize=256m -XX:MaxPermSize=512m -Xms1024m -Xmx1532m 
 
 
SOA_REPOS_DBURL = jdbc:oracle:thin:@192.168.xxx.xxx:1521/DBSCHEMA
SOA_REPOS_DBUSER_PREFIX  = QA
SOA_REPOS_DBPASSWORD     = welcome1
 
BPM_ENABLED=false
BAM_ENABLED=true
B2B_ENABLED=true
ESS_ENABLED=true
 
ADMIN_PORT=6001
MANAGED_SOA_PORT=6100
MANAGED_BAM_PORT=6200
MANAGED_OSB_PORT=6300

Note here all properties defined are string values, when port numbers are read from this properties need to convert to integer type using int() funciton.


Then we need to create the below script create_soa_clustered_doamin.py
loadProperties('clustersoa_osb_domain.properties')
ADM_JAVA_ARGUMENTS = '-XX:PermSize=256m -XX:MaxPermSize=512m -Xms1024m -Xmx1532m -Dweblogic.Stdout='+LOG_FOLDER+'AdminServer.out -Dweblogic.Stderr='+LOG_FOLDER+'AdminServer_err.out'
def createBootPropertiesFile(directoryPath,fileName, username, password):
  serverDir = File(directoryPath)
  bool = serverDir.mkdirs()
  fileNew=open(directoryPath + '/'+fileName, '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()

def changeDatasourceToXA(datasource):
  print 'Change datasource '+datasource
  cd('/')
  cd('/JDBCSystemResource/'+datasource+'/JdbcResource/'+datasource+'/JDBCDriverParams/NO_NAME_0')
  set('DriverName','oracle.jdbc.xa.client.OracleXADataSource')
  set('UseXADataSourceInterface','True') 
  cd('/JDBCSystemResource/'+datasource+'/JdbcResource/'+datasource+'/JDBCDataSourceParams/NO_NAME_0')
  set('GlobalTransactionsProtocol','TwoPhaseCommit')
  cd('/')

def changeManagedServer(server,port,java_arguments):
  cd('/Servers/'+server)
  set('Machine'      ,'LocalMachine')
  set('ListenAddress',SERVER_ADDRESS)
  set('ListenPort'   ,port)

  create(server,'ServerStart')
  cd('ServerStart/'+server)
  set('Arguments' , java_arguments+' -Dweblogic.Stdout='+LOG_FOLDER+server+'.out -Dweblogic.Stderr='+LOG_FOLDER+server+'_err.out')
  set('JavaVendor','Sun')
  set('JavaHome'  , JAVA_HOME)

  cd('/Server/'+server)
  create(server,'SSL')
  cd('SSL/'+server)
  set('Enabled'                    , 'False')
  set('HostNameVerificationIgnored', 'True')

  if JSSE_ENABLED == true:
    set('JSSEEnabled','True')
  else:
    set('JSSEEnabled','False')  

  cd('/Server/'+server)
  create(server,'Log')
  cd('/Server/'+server+'/Log/'+server)
  set('FileName'     , LOG_FOLDER+server+'.log')
  set('FileCount'    , 10)
  set('FileMinSize'  , 5000)
  set('RotationType' ,'byTime')
  set('FileTimeSpan' , 24)

  print('Start...wls domain with template /home/oracle/products/12.2.1/Oracle_Home/wlserver/common/templates/wls/wls.jar')
readTemplate(ORACLE_HOME+'/wlserver/common/templates/wls/wls.jar')

cd('/')
print('Set domain log')
create('base_domain','Log')

cd('/Log/base_domain')
set('FileName'    ,LOG_FOLDER+DOMAIN+'.log')
set('FileCount'   ,10)
set('FileMinSize' ,5000)
set('RotationType','byTime')
set('FileTimeSpan',24)

cd('/Servers/AdminServer')
# name of adminserver
set('Name',ADMIN_SERVER )

cd('/Servers/'+ADMIN_SERVER)

# address and port
set('ListenAddress',SERVER_ADDRESS)
set('ListenPort',int(ADMIN_PORT))

setOption( "AppDir", APP_PATH )

create(ADMIN_SERVER,'ServerStart')
cd('ServerStart/'+ADMIN_SERVER)
set('Arguments' , ADM_JAVA_ARGUMENTS)
set('JavaVendor','Sun')
set('JavaHome'  , JAVA_HOME)

cd('/Server/'+ADMIN_SERVER)
create(ADMIN_SERVER,'SSL')
cd('SSL/'+ADMIN_SERVER)
set('Enabled'                    , 'False')
set('HostNameVerificationIgnored', 'True')

if JSSE_ENABLED == true:
  set('JSSEEnabled','True')
else:
  set('JSSEEnabled','False')


cd('/Server/'+ADMIN_SERVER)

create(ADMIN_SERVER,'Log')
cd('/Server/'+ADMIN_SERVER+'/Log/'+ADMIN_SERVER)
set('FileName'    ,LOG_FOLDER+ADMIN_SERVER+'.log')
set('FileCount'   ,10)
set('FileMinSize' ,5000)
set('RotationType','byTime')
set('FileTimeSpan',24)

print('Set password...')
cd('/')
cd('Security/base_domain/User/weblogic')

# weblogic user name + password
set('Name',ADMIN_USER)
cmo.setPassword(ADMIN_PASSWORD)

if DEVELOPMENT_MODE == true:
  setOption('ServerStartMode', 'dev')
else:
  setOption('ServerStartMode', 'prod')

setOption('JavaHome', JAVA_HOME)

print('write domain...')
# write path + domain name
writeDomain(DOMAIN_PATH)
closeTemplate()

createAdminStartupPropertiesFile(DOMAIN_PATH+'/servers/'+ADMIN_SERVER+'/data/nodemanager',ADM_JAVA_ARGUMENTS)
createBootPropertiesFile(DOMAIN_PATH+'/servers/'+ADMIN_SERVER+'/security','boot.properties',ADMIN_USER,ADMIN_PASSWORD)
createBootPropertiesFile(DOMAIN_PATH+'/config/nodemanager','nm_password.properties',ADMIN_USER,ADMIN_PASSWORD)

es = encrypt(ADMIN_PASSWORD,DOMAIN_PATH)

readDomain(DOMAIN_PATH)

print('set domain password...') 
cd('/SecurityConfiguration/'+DOMAIN)
set('CredentialEncrypted',es)

print('Set nodemanager password')
set('NodeManagerUsername'         ,ADMIN_USER )
set('NodeManagerPasswordEncrypted',es )

cd('/')

setOption( "AppDir", APP_PATH )

print('Extend...osb domain with template /opt/oracle/middleware12c/osb/common/templates/wls/oracle.osb_template.jar')
addTemplate(ORACLE_HOME+'/oracle_common/common/templates/wls/oracle.wls-webservice-template.jar')
addTemplate(ORACLE_HOME+'/osb/common/templates/wls/oracle.osb_template.jar')

print 'Adding ApplCore Template'
addTemplate(ORACLE_HOME+'/oracle_common/common/templates/wls/oracle.applcore.model.stub_template.jar')

print 'Adding SOA Template'
addTemplate(ORACLE_HOME+'/soa/common/templates/wls/oracle.soa_template.jar')

if BAM_ENABLED == true:
  print 'Adding BAM Template'
  addTemplate(ORACLE_HOME+'/soa/common/templates/wls/oracle.bam.server_template.jar')

if BPM_ENABLED == true:
  print 'Adding BPM Template'
  addTemplate(ORACLE_HOME+'/soa/common/templates/wls/oracle.bpm_template.jar')

if WEBTIER_ENABLED == true:
  print 'Adding OHS Template'
  addTemplate(ORACLE_HOME+'/ohs/common/templates/wls/ohs_managed_template.jar')

if B2B_ENABLED == true:
  print 'Adding B2B Template'
  addTemplate(ORACLE_HOME+'/soa/common/templates/wls/oracle.soa.b2b_template.jar')

if ESS_ENABLED == true:
  print 'Adding ESS Template'
  addTemplate(ORACLE_HOME+'/oracle_common/common/templates/wls/oracle.ess.basic_template.jar')
  addTemplate(ORACLE_HOME+'/em/common/templates/wls/oracle.em_ess_template.jar')

dumpStack()

print 'Change datasources'

print 'Change datasource LocalScvTblDataSource'
cd('/JDBCSystemResource/LocalSvcTblDataSource/JdbcResource/LocalSvcTblDataSource/JDBCDriverParams/NO_NAME_0')
set('URL',SOA_REPOS_DBURL)
set('PasswordEncrypted',SOA_REPOS_DBPASSWORD)
cd('Properties/NO_NAME_0/Property/user')
set('Value',SOA_REPOS_DBUSER_PREFIX+'_STB')

print 'Call getDatabaseDefaults which reads the service table'
getDatabaseDefaults()    

changeDatasourceToXA('EDNDataSource')
changeDatasourceToXA('wlsbjmsrpDataSource')
changeDatasourceToXA('OraSDPMDataSource')
changeDatasourceToXA('SOADataSource')

if BAM_ENABLED == true:
  changeDatasourceToXA('BamDataSource')

print 'end datasources'
setOption( "AppDir", APP_PATH )

print('Create machine LocalMachine with type UnixMachine')
cd('/')
create('LocalMachine','UnixMachine')
cd('UnixMachine/LocalMachine')
create('LocalMachine','NodeManager')
cd('NodeManager/LocalMachine')
set('ListenAddress',SERVER_ADDRESS)

print 'Change AdminServer'
cd('/Servers/'+ADMIN_SERVER)
set('Machine','LocalMachine')

cd('/')
if ESS_ENABLED == true:
  delete('ess_server1', 'Server')

if BAM_ENABLED == true:
  delete('bam_server1', 'Server')

delete('soa_server1', 'Server')
delete('osb_server1', 'Server')

print 'Create SoaCluster'
cd('/')
create('SoaCluster', 'Cluster')
for i in range (1,3):
 print 'Create SoaServer'+str(i)
 cd('/')
 create('SoaServer'+str(i), 'Server')
 changeManagedServer('SoaServer'+str(i),int(MANAGED_SOA_PORT)+i,SOA_JAVA_ARGUMENTS)
 cd('/')
 assign('Server','SoaServer'+str(i),'Cluster','SoaCluster')
 
if BAM_ENABLED == true:
 print 'Create BamCluster'
 cd('/')
 create('BamCluster', 'Cluster')
 for i in range (1,3):
   print 'Create BamServer'+str(i)
   cd('/')
   create('BamServer'+str(i), 'Server')
   changeManagedServer('BamServer'+str(i),int(MANAGED_BAM_PORT)+i,BAM_JAVA_ARGUMENTS)
   cd('/')
   assign('Server','BamServer'+str(i),'Cluster','BamCluster')
 
print 'Create OsbCluster'
cd('/')
create('OsbCluster', 'Cluster')
for i in range (1,3):
 print 'Create OsbServer'+str(i)
 cd('/')
 create('OsbServer'+str(i), 'Server')
 changeManagedServer('OsbServer'+str(i),int(MANAGED_OSB_PORT)+i,OSB_JAVA_ARGUMENTS)
 cd('/')
 assign('Server','OsbServer'+str(i),'Cluster','OsbCluster')

print 'Add server groups WSM-CACHE-SVR WSMPM-MAN-SVR JRF-MAN-SVR to AdminServer'
serverGroup = ["WSM-CACHE-SVR" , "WSMPM-MAN-SVR" , "JRF-MAN-SVR"]
setServerGroups(ADMIN_SERVER, serverGroup)                      

if ESS_ENABLED == true:
  print 'Add server group SOA-MGD-SVRS,ESS-MGD-SVRS to soa_server1'
  cd('/')
  serverGroup = ["SOA-MGD-SVRS","ESS-MGD-SVRS"]
else:
  print 'Add server group SOA-MGD-SVRS to SoaServer1 2'
  serverGroup = ["SOA-MGD-SVRS"]

setServerGroups('SoaServer1', serverGroup)                      
setServerGroups('SoaServer2', serverGroup)                      

if BAM_ENABLED == true:
  print 'Add server group BAM12-MGD-SVRS to BamServer1 2'
  serverGroup = ["BAM12-MGD-SVRS"]
  setServerGroups('BamServer1', serverGroup)                      
  setServerGroups('BamServer2', serverGroup)                      

print 'Add server group OSB-MGD-SVRS-COMBINED to OsbServer1 2'
serverGroup = ["OSB-MGD-SVRS-COMBINED"]
setServerGroups('OsbServer1', serverGroup)                      
setServerGroups('OsbServer2', serverGroup)                      

print 'end server groups'

updateDomain()
closeDomain();

createBootPropertiesFile(DOMAIN_PATH+'/servers/SoaServer1/security','boot.properties',ADMIN_USER,ADMIN_PASSWORD)
createBootPropertiesFile(DOMAIN_PATH+'/servers/SoaServer2/security','boot.properties',ADMIN_USER,ADMIN_PASSWORD)

if BAM_ENABLED == true:
  createBootPropertiesFile(DOMAIN_PATH+'/servers/BamServer1/security','boot.properties',ADMIN_USER,ADMIN_PASSWORD)
  createBootPropertiesFile(DOMAIN_PATH+'/servers/BamServer2/security','boot.properties',ADMIN_USER,ADMIN_PASSWORD)

createBootPropertiesFile(DOMAIN_PATH+'/servers/OsbServer1/security','boot.properties',ADMIN_USER,ADMIN_PASSWORD)
createBootPropertiesFile(DOMAIN_PATH+'/servers/OsbServer2/security','boot.properties',ADMIN_USER,ADMIN_PASSWORD)

print('Exiting...')
exit()


Run wlst create_soa_clustered_domain.py

Finally you see the below output

SOA domain


Monday, June 29, 2015

HTML format output for wlst scripts - Threadpool and server status



1. Download the HTML.py module from the following link http://www.decalage.info/python/html and place this in wlserver_10.3/common/wlst/modules

2. Below script will generate html file upon successful execution and it will be placed in the same directory from where you execute the script

#!/usr/bin/python
import sys
sys.path.insert(0,'/u01/app/oracle/product/fmw/wlserver_10.3/common/wlst/modules/HTML.py')
import HTML
tohtmlfile=open('ThreadPoolStatusHTMLFILE.html', 'w')

def connection():
    try:
        connect(wls_username,wls_password,url);
    except:
        "Unable to connect to the Admin Server, Please check!"
        
def Threadpoolstatus():
    tabledata=HTML.Table(header_row=['Server Name','Status','Completed Requests','Hogging Threads','Total Threads','Idle Threads','Pending','Queue Length','Throughput']);
    urldict={}
    serverConfig()
    serverlist=cmo.getServers()  # Getting Serverlist
    for svr in serverlist:
        cd("/Servers/"+svr.getName());
        urldict[svr.getName()]='t3://'+get('ListenAddress')+':'+str(get('ListenPort'));
    myKeyS = urldict.keys()
    myKeyS.sort()
    print "%7s %7s %7s %7s %7s %7s %7s %7s" % ('ServerName','compReq','hoggingThreads','totalThreads','idleThrds','pending','qLen','thruput');
    for name in myKeyS:
        connect("weblogic","Welcome1",url=urldict[name]);
        ServerName=str(name);
        cd('serverRuntime:/ThreadPoolRuntime/ThreadPoolRuntime/')
        statusstring = str(cmo.getHealthState())
        Status=statusstring.split(',')[1].split(':')[1]
        compReq = cmo.getCompletedRequestCount();
        hoggingThreads = cmo.getHoggingThreadCount();
        totalThreads = cmo.getExecuteThreadTotalCount();
        idleThrds = int(cmo.getExecuteThreadIdleCount());
        pending = cmo.getPendingUserRequestCount();
        qLen = cmo.getQueueLength();
        thruput = cmo.getThroughput();    
        print "%7s %7s %7d %10d %15d %10d %10d %10d" % (ServerName,compReq,hoggingThreads,totalThreads,idleThrds,pending,qLen,thruput)
        if idleThrds == 0 or Status <> 'HEALTH_OK':
            TPstatus = HTML.TableRow([ServerName,Status,compReq,hoggingThreads,totalThreads,idleThrds,pending,qLen,thruput],bgcolor='red')
        else:
            TPstatus = HTML.TableRow([ServerName,Status,compReq,hoggingThreads,totalThreads,idleThrds,pending,qLen,thruput],bgcolor='lime')
        tabledata.rows.append([TPstatus])

    myhtmlcode = tabledata
    print>>tohtmlfile, myhtmlcode

if __name__== "main":
    redirect('threadpoolstatus.log', 'false')
    connection()
    Threadpoolstatus()