Monday Sep 13, 2010

Startup Scripts for WebLogic and SOA Suite

Yes I know there are many blogs and sites out there that have startup scripts for WebLogic. I have noticed that some are very detailed and maybe a bit complex for a newbe. Therefore goal of this post is to provide new administrators a basic startup script for WebLogic with an emphasis on SOA Suite. You should be able to use these scripts as a base to start building more complex scripts that accept parameters, or start clusters, etc.


  1. If you want Node Manager to restart a failed Managed server you must ensure that either the nodemanager.properties file or the startup.properties has the parameters AutoRestart=true and StartScriptEnabled=true. I believe this is set to true in the startup.properties by default. The nodemanager.properties file can be found in  $MW_HOME/wlserver_10.3/common/nodemanager
  2. I use 2 scripts to start WebLogic, a control shell script, which then calls a WLST script. For the purpose of this blog I have placed the scripts in the following directory.

    /home/oracle/scripts/weblogic/startup

  3. 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 &

  4. 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".

If you want a shutdown script, it is much the same but in reverse.


  1. 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 &

  2. 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()

Happy scripting.

About

Discussions and Examples using Oracle Fusion Middleware. Some image links are broken when using Firefox, Safari, and Chrome. If you want to see the full image please use IE.

Twitter:@james8001

tumblr hit counter vistors, thanks for your support

Search

Archives
« April 2014
SunMonTueWedThuFriSat
  
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
   
       
Today