Wednesday, October 13, 2010

WLST -I : Weblogic Useful WLST Commands

WLST ( Weblogic Scripting Tool )

How to invoke WLST 

Go to your_domain/bin and run below command

D:\Oracle\Middleware\user_projects\domains\base_domain\bin>java weblogic.WLST

What if you are getting below error just after invoking WLST

Exception in thread "main" java.lang.NoClassDefFoundError: weblogic/WLST
Caused by: java.lang.ClassNotFoundException: weblogic.WLST

Run D:\Oracle\Middleware\user_projects\domains\base_domain\bin>setDomainEnv.cmd

Now you would able to connect with java weblogic.WLST command

Commands -

Node Manager Commands for WLST Configuration

Command Enables you to… Use with WLST...
nm Determine whether WLST is connected to Node Manager. Online
nmConnect Connect WLST to Node Manager to establish a session. Online or Offline
nmDisconnect Disconnect WLST from a Node Manager session. Online or Offline
nmEnroll Enables the Node Manager on the current computer to manage servers in a specified WebLogic domain. Online
nmGenBootStartupProps Generates the Node Manager property files, and, for the specified server. Online
nmKill Kill the specified server instance that was started with Node Manager. Online or Offline
nmLog Return the Node Manager log. Online or Offline
nmServerLog Return the server output log of the server that was started with Node Manager. Online or Offline
nmServerStatus Return the status of the server that was started with Node Manager. Online or Offline
nmStart Start a server in the current WebLogic domain using Node Manager. Online or Offline
nmVersion Return the Node Manager version. Online or Offline
startNodeManager Starts Node Manager on the same computer that is running WLST. Online or Offline
stopNodeManager Stops Node Manager. Online or Offline


Take help on online or offline commands 


See my post "WLST Online and Offline Commands" for details on online & offline commands

Start Node Manager

where -
Node Manager Home - D:/Oracle/Middleware/wlserver_10.3/common/nodemanager
Node Manager Host host - localhost
Node Manager port - 5557

Connect with node manager


To check if you already connect with node manager or not



wls:/JJTU_Domain1/serverConfig> nm()
Currently connected to Node Manager to monitor the domain JJTU_Domain1.

Start Admin server using node manager

where "AdminServer" is the name of your admin server.

Check Admin Server Status unsing nodemanager


where "AdminServer" is the name of your admin server.

Connect to Admin Server

where -
admin user - weblogic
admin password=webl0gic
weblogic host - localhost
admin port - 7001

Start Managed Server using nodemanager


wls:/JJTU_Domain1/serverConfig> nmStart('C_Server1')
Starting server C_Server1 ...
Successfully started server C_Server1 ...

Start Managed Server 


Where MS1 is the name of your managed server

To kill server using node manager



wls:/JJTU_Domain1/serverConfig> nmKill('C_Server1')
Killing server C_Server1 ...
Successfully killed server C_Server1 ...

To check node manager status



wls:/JJTU_Domain1/serverConfig> nmVersion()
The Node Manager version that you are currently connected to is 10.3.

Domain enrollment with nmEnroll()


NmEnroll is used to enroll a machine or you can say to enroll a domain with the node manager because if you have multiple domains ( of different installer ) running on a host then you can handle all with a single node manager but you have have to enroll each domain with the same node manager. 

This is applicable if you have domains from different oracle_home or you can say from different installer on same host ( means you have more than one installation of weblogic on same host with each installer having its different host ).

If you are creating multiple domains from single installer then no need to enroll because it will enroll automatically. 

So to enroll a machine or domain with a particular node manager, follow below steps

1. Start Admin server of domain which you want to enroll with node manager

2. Go to wlst prompt ( go to your_domain, run setDomainEnv and then "java weblogic.WLST")

3. Connect with admin server

4. Run nmEnroll command

   Where "C:/Oracle/Middleware/wlserver_12.1/common/nodemanager" is the node manager    
   home of node manager with which you want to enroll your domain

5. Update under node manager home and add your domain path in     
    same format as earlier domains path there, like below i have added domain in red


6. Update node manager password ( username also if not correct there ) from admin console
    ( login to admin console > click on your domain name on left hand side > click on security tab  
     on right hand side > click on Advance link > update node manager password ( username 
     also if not correct there )

Now you can able to connect with node manager

wls:/base_domain/serverConfig> nmConnect("weblogic","weblogic123","localhost","40046","base_domain","C:/Oracle/Middleware2/user_projects/domains/base_domain","plain")
Connecting to Node Manager ...
Successfully Connected to Node Manager.

Note 1 - 

If you are getting below error during connect with node manager, then it means you haven't changed username,password for nodemanager from admin console ( above step 6 )

WLSTException: Error occured while performing nmConnect : Cannot connect to Node Manager. : Access to domain 'base_domain' for user 'weblogic' denied

Note 2 - 

If you are getting below error during connect of node manager then it mean you haven't followed above defined steps OR haven't added your domain on

WLSTException: Error occured while performing nmConnect : Cannot connect to Node Manager. : Configuration error while reading domain directory

Disconnect from node manager



wls:/JJTU_Domain1/serverConfig> nmDisconnect()
Successfully disconnected from Node Manager.

Stop Node Manager



wls:/JJTU_Domain1/serverConfig> stopNodeManager()
Stopped NodeManager successfully

Important Note :

In order to stop the Node Manager process, Node Manager must have been started with the property QuitEnabled=true. You can configure this property in $WLS_HOME/common/ This allows you to connect to the Node Manager to shut it down.

1 comment:

  1. This comment has been removed by a blog administrator.