International: United States [ Change ]
Certidea: best learning material for IT exams. Fastest and Guaranteed Certify!
    McAfee SECURE sites help keep you safe from identity theft, credit card fraud, spyware, spam, viruses and online scams
 
 
Login RegisterAccountshopping cartShopping Cart 

Certidea Certifications News

How to Startup Scripts for WebLogic

- By Megan Taylor on September 14, 2010

One of my customer ask me the startup scripts for WebLogic. He said that he found many articles about this topic. But this seems a little complex for him as a newbe. Now I would like to share new administrators with basic startup script for WebLogic with an emphasis on SOA Suite. This post serves as a base to start building more complex scripts that accept parameters, or start clusters, etc.

Supposing you want Node Manager to reboot a failed Managed server, you should make sure that either the nodemanager.properties file or the startup.properties has the parameter AutoRestart=true. I believe this is set to true in the startup.properties by default.

Now use 2 scripts to start WebLogic, a control shell script, which then calls a WLST script. For the purpose of this news I have placed the scripts in the following directory.

/home/oracle/scripts/weblogic/startup

Create a scripts called startNM.sh in the directory your choice, e.g. /home/oracle/scripts/weblogic/startup
here is a sample, adjust for your environment:

MW_HOME=/u01/oracle/product/middleware

$MW_HOME/oracle_common/common/bin/setNMProps.sh

nohup $MW_HOME/wlserver_10.3/server/bin/startNodeManager.sh > $MW_HOME/wlserver_10.3/common/nodemanager/nodemanager.out &

nohup $MW_HOME/user_projects/domains/soa_domain/bin/startWebLogic.sh > $MW_HOME/user_projects/domains/soa_domain/servers/AdminServer/logs/AdminServer.out &

. $MW_HOME/user_projects/domains/soa_domain/bin/setDomainEnv.sh

java weblogic.WLST /home/oracle/scripts/weblogic/startup/startMS.py

Please note that each command is separated by a empty line, therefore the nohup commands are one command until the &

Now create the WLST script as called by the startNM.sh script above. Call it startMS.py:

import time
sleep=time.sleep
print "#####################################"
print "# Waiting for Admin Server to Start #"
print "#####################################"
while True:
try:
connect(adminServerName="AdminServer")
break

except:

sleep(60)

print "##############################"
print "# Admin Server has come up #"
print "##############################"

print "##########################"
print "# Starting SOA Server 1 #"
print "##########################"

start(name="soa_server1", block="true")

print "##########################"
print "# Starting OSB Server #"
print "##########################"

start(name="osb_server1", block="true")

print "##########################"
print "# Starting BAM Server #"
print "##########################"

start(name="bam_server1", block="true")

exit()

When you use these scripts you will get errors in the WLST script while it waits for the AdminServer to come up this is to be expected so just ignore. I have set the retry for 60 seconds so it shouldn't try too many times.

Also you may get an error like 'ERROR: transport error 202: bind failed: Address already in use'. This is caused because 2 managed servers are using the same debugging port. If this is the case then you can edit the setDomainEnv.sh file and turn debugging off. Do this by searching for debugFlag="true" and set it to false, e.g. debugFlag="false".

Now a shutdown script, it is much the same but in reverse.

Create a script called stopMN.sh in directory of your choice, e.g. /home/oracle/scripts/weblogic/shutdown:

MW_HOME=/u01/oracle/product/middleware

. $MW_HOME/user_projects/domains/soa_domain/bin/setDomainEnv.sh

$MW_HOME/oracle_common/common/bin/setNMProps.sh

java weblogic.WLST /home/oracle/scripts/weblogic/shutdown/stopMS.py

nohup $MW_HOME/user_projects/domains/soa_domain/bin/stopWebLogic.sh > $MW_HOME/user_projects/domains/soa_domain/servers/AdminServer/logs/AdminServerShutdown.out &

Create a WLST script in the same directory called stopMS.py:

connect(adminServerName="AdminServer")

exitonerror=false
# Stop all managed Servers
shutdown('soa_server1','Server', force="true")
shutdown('osb_server1','Server', force="true")
shutdown('bam_server1','Server', force="true")

exit()

Trackback: The Oracle official website Megan Taylor, a senior engineer of CertIdea which is the leading certification study material provider for IT professionals. If you meet some technical difficulties and need her help, she can be reached by support@certidea.com.

--By Certidea Sales Team