Offline WLST script to create domain in WLS 11gR1
Cluster, managed servers, and a WAR — no server running
---
Posted by Unni on Sun 4 Oct 11:15 download
-
# This is an Offline WLST script to create a WLS 10.3.1 (Oracle Weblogic Server 11gR1) Domain
-
#
-
# Domain consists of:
-
# 1. Admin Server
-
# 2. Two Managed Servers
-
# 3. A Cluster with Two Managed Server
-
# 4. An application deployed to the cluster
-
# Read a domain template
-
print(‘Reading Template - D:/Oracle/11gR1/one/wlserver_10.3/common/templates/domains/wls.jar’)
-
readTemplate(‘D:/Oracle/11gR1/one/wlserver_10.3/common/templates/domains/wls.jar’)
-
# Admin Server
-
print(‘Creating Server - Admin Server’)
-
cd(‘Servers/AdminServer’)
-
set(‘ListenAddress’,‘localhost’)
-
set(‘ListenPort’, 7001)
-
create(‘AdminServer’,‘SSL’)
-
cd(‘SSL/AdminServer’)
-
set(‘Enabled’, ‘True’)
-
set(‘ListenPort’, 7002)
-
# Security
-
print(‘Creating Password’)
-
cd(’/’)
-
cd(‘Security/base_domain/User/weblogic’)
-
cmo.setPassword(‘welcome1’)
-
# Start Up
-
print(‘Setting StartUp Options’)
-
setOption(‘CreateStartMenu’, ‘false’)
-
setOption(‘ServerStartMode’, ‘dev’)
-
setOption(‘JavaHome’,‘D:/Oracle/11gR1/one/jrockit_160_05_R27.6.2-20’)
-
setOption(‘OverwriteDomain’, ‘true’)
-
# Create Domain to File System
-
print(‘Writing Domain To File System’)
-
writeDomain(‘D:/Oracle/11gR1/one/user_projects/domains/OfflineDomain_WLST’)
-
closeTemplate()
-
# Read the Created Domain
-
print(‘Reading the Domain from In Offline Mode’)
-
readDomain(‘D:/Oracle/11gR1/one/user_projects/domains/OfflineDomain_WLST’)
-
# Creating Managed Servers
-
print(‘Creating Server - MS1 on Port # 8001’)
-
cd(’/’)
-
create(‘MS1’, ‘Server’)
-
cd(‘Server/MS1’)
-
set(‘ListenPort’, 8001)
-
set(‘ListenAddress’, ‘localhost’)
-
print(‘Creating Server - MS2 on Port # 8011’)
-
cd(’/’)
-
create(‘MS2’, ‘Server’)
-
cd(‘Server/MS2’)
-
set(‘ListenPort’, 8011)
-
set(‘ListenAddress’, ‘localhost’)
-
# Create and configure a cluster and assign the Managed Servers to that cluster.
-
print(‘Creating Cluster - WLSTCluster and adding MS1, MS2’)
-
cd(’/’)
-
create(‘WLSTCluster’, ‘Cluster’)
-
assign(‘Server’, ‘MS1,MS2’,‘Cluster’,‘WLSTCluster’)
-
cd(‘Cluster/WLSTCluster’)
-
set(‘MulticastAddress’, ‘237.0.0.101’)
-
set(‘MulticastPort’, 8050)
-
set(‘WeblogicPluginEnabled’, ‘true’)
-
# Create a new application deployment - Deployment Archive : “d:/Lou/VersionInfo.war”
-
print(‘Deploying application named VersionInfo from d:\Lou**\V**ersionInfo.war’)
-
cd(’/’)
-
myApp=create(‘VersionInfo’, ‘AppDeployment’)
-
myApp.setSourcePath(‘d:/Lou/VersionInfo.war’)
-
assign(‘AppDeployment’, ‘VersionInfo’, ‘Target’, ‘WLSTCluster’)
-
# updating the changes
-
print(‘Finalizing the changes’)
-
updateDomain()
-
closeDomain()
-
# Exiting
-
print(‘Exiting…’)
-
exit()
-
# Code written by:
-
# Unnikrishnan Pillai
---