24 February 2013

Manually Creating a Basic WebLogic Domain with wlst.sh

This is really just a reminder to myself on how to manually create a WebLogic domain using the wlst.sh command line, start the node manager, start the AdminServer, store user configuration for future logins etc. - but it may be useful to others too.

First of all, there are example scripts of how to create various domains using wlst.sh in the directory: $MW_HOME/wlserver_12.1/common/templates/scripts/wlst. Also, you will find actual domain templates in the directory $MW_HOME/wlserver_12.1/common/templates/domains directory.

But for sake of completeness here's an example:

cd 

export MW_HOME=$HOME/app/oracle/MW1211
$MW_HOME/wlserver_12.1/common/bin/wlst.sh

import os

# Set various variables based on environment
mwHome= os.environ["MW_HOME"]
wlHome= mwHome + "/wlserver_12.1"
nmHome= wlHome + '/common/nodemanager'
domainName= "dev"
domainDir = mwHome + "/user_projects/domains/" + domainName

createDomain(domainTemplate=wlHome + '/common/templates/domains/wls.jar', domainDir=domainDir, user='weblogic', password='welcome1')

readDomain(domainDir=domainDir)

# Set listen address and port, enable SSL and set SSL port
set('Name', 'dev')
set('AdministrationPort', '9002')
set('AdministrationPortEnabled', 'true')

cd('Server/AdminServer')
set('ListenPortEnabled', 'false')

# Finally, update domain
updateDomain()

# Start Node Manager
startNodeManager(verbose='true', NodeManagerHome=nmHome, ListenPort='5556', ListenAddress='')

# Connect to Node Manager
nmConnect(domainName=domainName, domainDir=domainDir)

# Start AdminServer
nmStart(serverName="AdminServer", domainDir=domainDir)

# Connect to AdminServer
connect(adminServerName="AdminServer", url="t3s://localhost:9002")


# Enroll domain in management by Node Manager and download nm_password.properties for authentication
nmEnroll(domainDir=domainDir, nmHome=nmHome)

# Store user configuration file in user $HOME directory containing encrypted weblogic 
# username & password for AdminServer and a key file containing key used for encryption
storeUserConfig()

(answer: y)


No comments: