Friday, September 25, 2009

How to Install Node Manager as Windows Service and Monitor MServers State

Hello, in this first post I will go step by step on how to install WLS 10.3.1 Node Manager as a Windows Service and configure it to monitor Managed Servers state, that is, to keep them running in case of a crash.






For this we assume that WLS 10.3.1 is installed with the default options and the domains folder follow the standard installation path.
In this example I have created a domain with a AdminServer:7001 and two Managed Servers: ms1:7003 and ms2:7005. Both ms1, ms2 and the AdminServer are configured under machine1, this is a requisite for our configuration.



Step 1 - Configure Node Manager Properties File:
Go to BEA_HOME/WL_HOME/common/nodemanager and open nodemanager.properties. Change the following properties to:
CrashRecoveryEnabled=true
StartScriptEnabled=true


Step 2 - Install Node Manager as Windows Service:
Execute the following script: BEA_HOME/WL_HOME/server/bin/installNodeMgrSvc.cmd.
This should create a Windows Service called "Oracle WebLogic NodeManager (PATH_TO_DOMAIN)". Go to Windows Services and double click it. On the Log On tab, check the option "This Account" and provide the user/password you plan to use to run the WLS under windows. Click OK and start the service.




Step 3 - Starting the AdminServer:
Open a command prompt at BEA_HOME/user_projects/DOMAIN_NAME/bin and run the following script setDomainEnv.cmd. In the same command prompt window type: startWebLogic.cmd. The AdminServer should start now.




Step 4 - Starting the ManagedServers:
Open a browser and go to http://HOST:PORT/console. On the "Domain Structure" panel (upper left), click on Servers. On the Summary of Servers (middle right), go to the Control tab and select ms1 and ms2 and click on Start. The ms1 and ms2 should start.


Step 5 - Testing the work:
Let's go to the Windows Task Manager and check if our servers are there running.
Open the Task Manager (right-click on the windows clock and select the Task Manager option from the contextual menu) and sort the column Image Name. Now let's look for our Java processes....



There we can see our three Java processes, one for AdminServer, one for ms1 and ms2 respectively. You can also find there the Node Manager process, it's something like beasvc.exe. Now, let's simulate a server crash, let's kill our servers processes: select the java processes and click on End Process button. This way the server is abruptly shut-down and to the Node Manager this means a server crash. The Node Manager will restart the processes, and they will appear again on the Task Manager just a few seconds after you've killed it. To simulate a complete OS crash, lets kill the Node Manager process first (beasvc.exe) and then kill the java processes. Now, the java processes won't come back because the Node Manager is not running. Now after rebooting Windows and we can see that the Node Manager starts automatically, and just after that the java processes begins to show up on the Task Manager.


Final Considerations:
If you shutdown a Managed Server normally, be it through the Admin Console (with the provided stop scripts that comes with WLS installation), through WLST or even shutting down windows normally (Start button, Shutdown), the Node Manager will not monitor it anymore, it will consider that the server really should be down.
If you want to keep the AdminServer monitored by the Node Manager as well, you should start it through the WLST: on Step 3 don't use the startWebLogic.cmd. Instead, after setting the domain environments, type: java weblogic.WLST.
Then: nmConnect(domainName='DOMAIN_NAME').
Then nmStart('AdminServer').
This way the Node Manager is aware that it should also monitor the Admin Server state.

3 comments:

  1. Hi is there a way to start the managed servers through nodemanager via a windows service?

    I need to start the managed servers automatically when the admin server's OS starts. The admin server will start the managed server via the node manager as the intention is to allow the managed server to automatically restart if it clashes somehow.

    Please advise. So far I have read either using the admin console / WLST.

    ReplyDelete
  2. Thanks for the easy description of what at first appears to be a complicated beast.

    I have linked to this article from my own blog.

    ReplyDelete
  3. Hi Edwin,

    Once again I am back with one query for you. I am sure you would have answer for this as well. I am using WLS 10.0, JDK 1.5 and ojdbc14.jar in my application. I have created a datasource using oracle thin driver for creating connection from oracle server.
    Now, I have got one requirement wherein I have to call a stored procedure which takes array as a input. For same I am using :
    // Create an oracle.sql.ARRAY object to hold the values
    oracle.sql.ArrayDescriptor arrayDesc = oracle.sql.ArrayDescriptor.createDescriptor("OriginArray".toUpperCase(), conn);
    But when I am running my code it is giving me below mentioned exception:
    Exception:
    Unexpected Exception
    weblogic.rmi.extensions.RemoteRuntimeException: Unexpected Exception
    at weblogic.jdbc.rmi.internal.ConnectionImpl_weblogic_jdbc_wrapper_JTAConnection_weblogic_jdbc_wrapper_XAConnection_oracle_jdbc_driver_LogicalConnection_1000_WLStub.physicalConnectionWithin(Unknown Source)
    at weblogic.jdbc.rmi.SerialConnection_weblogic_jdbc_rmi_internal_ConnectionImpl_weblogic_jdbc_wrapper_JTAConnection_weblogic_jdbc_wrapper_XAConnection_oracle_jdbc_driver_LogicalConnection_1000_WLStub.physicalConnectionWithin(Unknown Source)
    at oracle.sql.TypeDescriptor.setPhysicalConnectionOf(TypeDescriptor.java:309)

    So now my question is, have you ever come accross such issue with wls datasource connections? One more thing, this code runs perfectly fine when I use type-I driver.

    Its looks like this is some compatiblity issue within libraries I have used.

    Looking forward to hear from you.

    Thanks,
    Allwyn
    BA.com
    London

    ReplyDelete