8i | 9i | 10g | 11g | 12c | 13c | 18c | Misc | PL/SQL | SQL | RAC | WebLogic | Linux

Home » Articles » Web » Here

Apply the JRF Template to a Domain Using WebLogic Scripting Tool (WLST)

WebLogic Scripting Tool (WLST) provides a command line scripting interface to manage WebLogic Server instances and domains. This article gives an example of applying the JRF template to a domain using WLST. You will need to adjust the values in the properties file and may wish to alter the script to suit your needs.

In this example we are applying the JRF template to a domain in offline mode, before the AdminServer has been started.

Script

Create a file called "apply_jrf_to_domain.py" with the following contents.

#!/usr/bin/python
# Author : Tim Hall
# Save Script as : apply_jrf_to_domain.py

import time
import getopt
import sys
import re

# Get location of the properties file.
properties = ''
try:
   opts, args = getopt.getopt(sys.argv[1:],"p:h::",["properies="])
except getopt.GetoptError:
   print 'apply_jrf_to_domain.py -p <path-to-properties-file>'
   sys.exit(2)
for opt, arg in opts:
   if opt == '-h':
      print 'apply_jrf_to_domain.py -p <path-to-properties-file>'
      sys.exit()
   elif opt in ("-p", "--properties"):
      properties = arg
print 'properties=', properties

# Load the properties from the properties file.
from java.io import FileInputStream
 
propInputStream = FileInputStream(properties)
configProps = Properties()
configProps.load(propInputStream)
 
# Set all variables from values in properties file.
middlewarePath=configProps.get("path.middleware")
domainConfigPath=configProps.get("path.domain.config")
domainName=configProps.get("domain.name")

# Display the variable values.
print 'middlewarePath=', middlewarePath
print 'domainConfigPath=', domainConfigPath
print 'domainName=', domainName

# Apply the JRF Template.
readDomain(domainConfigPath + '/' + domainName)
addTemplate(middlewarePath + '/oracle_common/common/templates/applications/jrf_template_11.1.1.jar')

# I'm including the EM template too.
addTemplate(middlewarePath + '/oracle_common/common/templates/applications/oracle.em_11_1_1_0_0_template.jar')
updateDomain()
closeDomain()
exit()

Properties

Create a file called "myDomain.properties" with the following contents.

# Paths
path.middleware=/u01/app/oracle/middleware
path.wls=/u01/app/oracle/middleware/wlserver_10.3
path.domain.config=/u01/app/oracle/config/domains
path.app.config=/u01/app/oracle/config/applications

# Credentials
domain.name=myDomain
domain.username=weblogic
domain.password=Password1

# Listening address
domain.admin.port=7001
domain.admin.address=ol6.localdomain

Run It

Apply the JRF template to an existing domain using the following commands.

# Set environment.
export MW_HOME=/u01/app/oracle/middleware
export WLS_HOME=$MW_HOME/wlserver_10.3
export WL_HOME=$WLS_HOME
export JAVA_HOME=/u01/app/oracle/jdk1.7.0_79
export PATH=$JAVA_HOME/bin:$PATH

. $WLS_HOME/server/bin/setWLSEnv.sh

# Apply the JRF template.
java weblogic.WLST apply_jrf_to_domain.py -p myDomain.properties

For more information see:

Hope this helps. Regards Tim...

Back to the Top.