Tuesday 9 April 2013

Starting SOA/BPM Suite with wlst via nodemanager


Today I installed the brand new SOA and BPM Suite 11g PS6. The last few months for me were dedicated in deepdiving WebLogic to deliver a Tuning and Troubleshooting course for two customers.

Although it was not the first time to for me to install the suite, and I already have several bash-based scripts to start the server using the weblogic shell scripts, I wanted to use my conceived knowledge to create a WLST based tool to start weblogic.

To create the tutorials for the course I already created a script to create and startup a new test domain with an adminserver and a managed server. And for the course I downsized the script to be able to start the domain. So I only had to adapt the script to be able to use it to start my SOABPM Domain.

Having it started using the nodemanager and also having a seperate AdminServer enables you to use the Admin Console to restart your SOAServer. So if you have enough memory it is the way to go. If you have not  enough memory choose the development topology at creation of the SOA/BPM domain. In that case the domain is created with only an admin server that contains both the Admin Console, EM and SOA/BPM.

Now the script is as follows:
#############################################################################
# Start SOABPM Domain 
#
# @author Martien van den Akker, Darwin-IT Professionals
# @version 0.1, 2013-04-09
#
#############################################################################
print 'Set Properties';
wlHome=os.getenv("WL_HOME")
nmHome=wlHome+'/common/nodemanager';
nmHost=os.getenv("NM_HOST");
nmPort=os.getenv("NM_PORT");
nmType=os.getenv("NM_TYPE");

domainsHome='/u01/app/work/domains';
SOABPMDomainName=os.getenv("SOABPM_DOMAIN_NAME");
SOABPMDomainHome=os.getenv("SOABPM_DOMAIN_HOME");
adminServerName=os.getenv("ADMIN_SERVER_NAME");
adminServerPort=os.getenv("ADMIN_SERVER_PORT");
SOAServerName=os.getenv("SOA_SERVER_NAME");

adminUser='weblogic';
adminPwd='welcome1';

print 'Start Nodemanager'
startNodeManager(verbose='true', NodeManagerHome=nmHome, ListenPort=nmPort, ListenAddress=nmHost);

print 'Connect to the Node Manager';
nmConnect(adminUser, adminPwd, nmHost, nmPort, SOABPMDomainName, SOABPMDomainHome, nmType);

print 'Start AdminServer';
nmStart(adminServerName);

print 'Connect to the AdminServer';
connect(adminUser, adminPwd);

print 'Start ManagedServer: '+SOAServerName;
start(SOAServerName);

If you set your wls settings as follows:
. $FMW_HOME/wlserver_10.3/server/bin/setWLSEnv.sh
export PATH=$WL_HOME/common/bin/:$WL_HOME/server/bin:$PATH

Then you can start the script as follows:
wlst.sh ./startSOABPMDomain.py

Provided that you have set your $FMW_HOME and $WL_HOME correctly (probably dependent on each other as in my case) and also the environment variables used in the script. And that you saved the script above as 'startSOABPMDomain.py'.

To provide for this and to enable the script to get the settings from the environment (and have the settings shared amongst shell and wlst scripts I have the following wls_env.sh script:
#!/bin/bash
echo Setting Weblogic Environment
export ORACLE_BASE=/u01/app/oracle
export FMW_HOME=/u01/app/oracle/Middleware/11.1.1
export DOMAINS_HOME=/u01/app/work/domains
export SOABPM_DOMAIN_NAME=SOABPMDomain
export SOABPM_DOMAIN_HOME=$DOMAINS_HOME/$SOABPM_DOMAIN_NAME
export NM_HOST=darlin-vce-db
export NM_PORT=5556
export NM_TYPE=plain
export OHS_HOME=/u01/app/work/instances/ohs1
export ADMIN_SERVER_NAME=AdminServer
export ADMIN_SERVER_PORT=7001
export SOA_SERVER_NAME=soa_server1

. $FMW_HOME/wlserver_10.3/server/bin/setWLSEnv.sh
export PATH=$WL_HOME/common/bin/:$WL_HOME/server/bin:$PATH

I prefer to get my settings from the environment. This is because I already have a bash script that sets the WLS and domain paths. This keeps things centralized. Note that I also have to set the paths to wlst.sh. If you prefer to load the properties in from a file in a more java way, then an example is found here. The stop script should look like something like:

#############################################################################
# Stop SOABPM Domain 
#
# @author Martien van den Akker, Darwin-IT Professionals
# @version 0.1, 2013-04-09
#
#############################################################################
print 'Set Properties';
wlHome=os.getenv("WL_HOME")
nmHome=wlHome+'/common/nodemanager';
nmHost=os.getenv("NM_HOST");
nmPort=os.getenv("NM_PORT");
nmType=os.getenv("NM_TYPE");

domainsHome='/u01/app/work/domains';
SOABPMDomainName=os.getenv("SOABPM_DOMAIN_NAME");
SOABPMDomainHome=os.getenv("SOABPM_DOMAIN_HOME");
adminServerName=os.getenv("ADMIN_SERVER_NAME");
adminServerPort=os.getenv("ADMIN_SERVER_PORT");
SOAServerName=os.getenv("SOA_SERVER_NAME");

adminUser='weblogic';
adminPwd='welcome1';

print 'Connect to the AdminServer';
connect(adminUser, adminPwd);

print 'Stop ManagedServer: '+SOAServerName;
shutdown(name=SOAServerName, entityType='Server', force='true');

print 'Stop AdminServer';
shutdown();

print 'Connect to the Node Manager';
nmConnect(adminUser, adminPwd, nmHost, nmPort, SOABPMDomainName, SOABPMDomainHome, nmType);

print 'Stop the NodeManager';
stopNodeManager();

A few things I encountered, that got me into writing this article are the following.

It is important that you have the listen-address of the machine, that the soa_server1 is added to, is the valid host-name of the server running your SOASuite. It cannot be 'localhost' which is defaulted by the SOA/BPM Domain configurator. The value 'localhost' simply does not work, although it is perfectly pingable. So update it according to your server (it should also point to the correct host-ip-address):


Also make sure you have Type set to 'Plain' and the property SecureListener=false in the $WL_HOME/common/nodemanager/nodemanager.properties accordingly. Here's my nodemanager.properties file as an example. The commented lines (except for the first one) denote the properties that are changed by me, the rest is default

#Fri Mar 15 14:28:18 CET 2013
DomainsFile=/u01/app/oracle/Middleware/11.1.1/wlserver_10.3/common/nodemanager/nodemanager.domains
LogLimit=0
PropertiesVersion=10.3
DomainsDirRemoteSharingEnabled=false
AuthenticationEnabled=true
NodeManagerHome=/u01/app/oracle/Middleware/11.1.1/wlserver_10.3/common/nodemanager
JavaHome=/usr/java/jdk1.6.0_43/jre
LogLevel=INFO
DomainsFileEnabled=true
StartScriptName=startWebLogic.sh
ListenAddress=darlin-vce-db
NativeVersionEnabled=true
ListenPort=5556
LogToStderr=true
#SecureListener=true
SecureListener=false
LogCount=1
DomainRegistrationEnabled=false
#StopScriptEnabled=false
StopScriptEnabled=true
QuitEnabled=true
LogAppend=true
StateCheckInterval=500
CrashRecoveryEnabled=false
#StartScriptEnabled=false
StartScriptEnabled=true
LogFile=/u01/app/oracle/Middleware/11.1.1/wlserver_10.3/common/nodemanager/nodemanager.log
LogFormatter=weblogic.nodemanager.server.LogFormatter
ListenBacklog=50


Then on the domain set the nodemanager's  username password correctly. I don't know the defaults, but they're probably not 'weblogic' and 'welcome1' as per my default values:

And then under Advanced:


Now ensure that you have enrolled your domain to the nodemanager.Check if it's listed in the $WL_HOME/common/nodemanager/nodemanager.domains file.

Some of my nodemanager-troubleshooting-knowledge is from this blog.

Hope this helps and at least save me some searching around the next time I have to setup a SOABPM-domain...

Oh, and of course you can split these files up to only start or stop the soaserver provided that the AdminServer and nodemanager are already started. And  to create separate start/stop for the BAM server, since I intentionally did not include that one in the scripts.

No comments :