Pages

Wednesday, April 20, 2011

Easy way to start your WebLogic Servers with the NodeManager in the background

When you work with Fusion Middleware you probably know you need to start the WebLogic Servers with the scripts located in the bin folder of your WebLogic domain and you need to start these servers in the background else these processes will be killed when you log out. On unix you can start these scripts in the background and on Windows you can try to make some Windows services with the service utility of WebLogic, but you need to update the path, classpath and java parameters of this service ( in the registry)  so it matches with the startup script. ( easy to make mistakes and memory changes can't be done from the WebLogic Console )

In this blogpost I will show you how you can start a WebLogic server from WLST in combination with a NodeManager which is started in the background of the server.

The first step is starting the Nodemanager once so the nodemanager.properties file is created. After this you can stop the nodemanager by killing the process
Go to XXX\wlserver_10.3\server\bin and start startNodeManager.cmd

Open the nodemanager.properties in a editor ( located in XXX\wlserver_10.3\common\nodemanager )
For FMW you need to change the StopScriptEnabled property to true, do the same for StartScriptEnabled 


On windows there is a utility to make a service for this nodemanager.
Go to XXX\wlserver_10.3\server\bin and start installNodeMgrSvc.cmd


Start the service

To automatically start a WebLogic Server and not prompted for a username / password  you need to create a boot.properties with username and password and put this in every server folder.

Start startWebLogic.cmd , located in the bin folder of your domain and when it is started then you can shut it down. Do the same for all the Managed Servers. start startManagedWebLogic.cmd xxxx, where xxxx is the name of the managed servers.

Go to XXX\domains\soa_domain\servers and create in every server folder a new folder called security
and create a boot.properties file and with the following content
username=weblogic
password=yourpassword

put this file in every security folder.

Next step is to set the nodemanager username and password
Start your WebLogic AdminServer
Go to the WebLogic Console, Domain and then open the Security tab

 Click on the Advanced link and set the nodemanager username and password

Activate the changes and shutdown the AdminServer

Now you try to start the AdminServer with WLST which connects to the NodeManager


Start XXX\wlserver_10.3\common\bin\wlst.cmd
you will see wls:/offline>

Connect to the NodeManager by using nmConnect
nmConnect('weblogic','yourpassword','localhost','5556','your_domain','C:/XXX/user_projects/domains/your_domain','ssl')
You need to see the  following Successfully Connected to Node Manager.

start the AdminServer
nmStart('AdminServer')

Ask the status of the AdminServer
nmServerStatus('AdminServer')

Stop the AdminServer
nmKill('AdminServer')

disconnect from the nodemanager
nmDisconnect()

Now you can make some cmd and WLST scripts

first create a start WLST script, called startDomain.wlst with the following content
nmConnect('weblogic','yourpassword','localhost','5556','wls_domain','C:/XXX/user_projects/domains/wls_domain','ssl')
nmStart('AdminServer')

nmStart('soa_server1')
nmDisconnect()


and a cmd script startDomain.cmd
call XXX\wlserver_10.3\common\bin\wlst.cmd startDomain.wlst


Now you have a script what you can add to windows task schedular or an other utility