Friday, February 17, 2012

Starting the Administration Server Using Node Manager and WLST

Weblogic 12c


The steps for starting an Administration Server using WLST and Node Manager are :

 

i)  Setting up your environment.

Add WebLogic Server classes to the CLASSPATH environment variable and WL_HOME\server\bin to the PATH environment variable.  OR

You can use a  C:\Oracle\Middleware\wlserver_12.1\server\bin\setWLSEnv.cmd  script to set both variables.



 

ii)  Start WLST Session using command : java weblogic.WLST



iii)  Start Node Manager using command :

                         startNodeManager(verbose='true', NodeManagerHome='C:\\Oracle\\Middleware\\wlserver_12.1\\common\\nodemanager', ListenPort='5556', ListenAddress='localhost')





iv) Connect WLST to a Node Manager by entering the nmConnect command.

nmConnect('weblogic', 'weblogic123', 'localhost', '5556', 'base_domain' , 'C:\\Oracle\\Middleware\\user_projects\\domains\\base_domain' , 'ssl')



note: Node Manager security relies on a one-way SSL connection between the client and server.If you are establishing a command line connection to the Java Node Manager using the WebLogic Server Scripting Tool (WLST) nmConnect command, you provide the Node Manager user name and password(here weblogic and weblogic123 respectively). Node Manager verifies the username and password against the domain's nm_password.properties file.Node Manager credentials are located on the Security>General>Advanced Options of Console page.Administration Console users do not need to explicitly provide credentials to connect to Node Manager—the Node Manager user name and password are available in the domain configuration and are provided automatically.

 

v) Use the nmStart command to start a server.
nmStart('AdminServer')



Monitor the status of the Administration Server by entering the nmServerStatus command.
nmServerStatus('AdminServer')

vi) Connect WLST to a running WebLogic Administration Server instance using the connect command.
connect('weblogic','weblogic123')



vii) Stop the AdminServer by entering the nmKill command.
nmKill('AdminServer')



viii) Disconnect the node manager :     nmDisconnect()   and   Exit the WLST:     exit()

10 comments:

  1. I get error when connect WLST to Admin Server

    javax.naming.CommunicationException [Root exception is java.net.ConnectException: t3://localhost:7001: Destination unreachable; nested exception is:
    java.net.ConnectException: Connection refused: connect; No available router to destination]
    Problem invoking WLST - Traceback (innermost last):
    File "C:\Users\Administrator\Desktop\admin\test.py", line 24, in ?
    File "", line 22, in connect
    File "", line 648, in raiseWLSTException
    WLSTException: Error occured while performing connect : Error getting the initia
    l context. There is no server running at t3://localhost:7001
    Use dumpStack() to view the full stacktrace

    ReplyDelete
  2. hi,

    the exception shows that weblogic admin server is not running at specified host port ( localhost 7001 ).
    check the Admin Server logs .
    Before the server comes to running state , it will give all the host and port on which the server is listening , you can use that host and
    port to connect to Admin Sever using WLST.

    Thanks,
    sandeep

    ReplyDelete
  3. If i run C:\Oracle\Middleware\user_projects\domains\base_domain\startWebLogic.cmd before then run connect() successfull.
    I don't know why? How to check weblogic admin server run at specified host port ?

    ReplyDelete
  4. when u run : C:\Oracle\Middleware\user_projects\domains\base_domain\startWebLogic.cmd
    This is the procedure to start the weblogic Admin Server .
    Hence you are able to connect using : connect()

    You can check the Admin Server logs : C:\Oracle\Middleware\user_projects\domains\base_domain\servers\AdminServer\logs

    the log will have Running status .

    ReplyDelete
  5. I think startWeblogic.cmd to start Admin Server same with nmStart(‘AdminServer’). What is different ?

    If i use startWeblogic.cmd and connect() then i don't need NodeManager to start ManagedServer.

    I want write all in 1 file to run. If use startWeblogic.cmd i can't because cmd run startWeblogic.cmd will loop while stop AdminServer.

    ReplyDelete
  6. Hi visaocuoitroi410,

    There is no such difference in starting the AdminServer through startWeblogic.cmd or through nmStart('AdminServer')
    only thing is for nmStart('AdminServer') , the nodemanager should be up and running and for startWeblogic.cmd no nodemanager is required.

    ReplyDelete
  7. Thanks but I still can't connect() after start Admin Server nmStart('AdminServer').
    I don't know why ?

    My jython code connect to AdminServer:

    startNodeManager(verbose=’true’, NodeManagerHome=’C:/Oracle/Middleware/wlserver_10.3/common/nodemanager’, ListenPort=’5556′, ListenAddress=’localhost’)
    nmConnect(‘weblogic’, ‘abcd123-’, ‘localhost’, ’5556′, ‘base_domain’, ‘C:/Oracle/Middleware/user_projects/domains/base_domain’,'ssl’)
    nmStart(‘AdminServer’)
    nmServerStatus(‘AdminServer’)
    connect(‘weblogic’, ‘abcd123-’) <-- error

    ReplyDelete
  8. try using full connect command : connect('weblogic','weblogic','t3://localhost:8001')

    ReplyDelete
  9. nmStart(‘AdminServer’)..is giving error in command prompt like this:
    Error Starting server AdminServer: weblogic.nodemanager.NMException: Exception while starting server 'AdminServer'.

    if we view the adminServer.out it is showing like this:

    java.lang.NoClassDefFoundError: Files\Java\jdk1/6/0_33\jre\bin;C:\Program
    Caused by: java.lang.ClassNotFoundException: Files\Java\jdk1.6.0_33\jre\bin;C:\Program
    at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
    Could not find the main class: Files\Java\jdk1.6.0_33\jre\bin;C:\Program. Program will exit.
    Exception in thread "main"

    ReplyDelete
  10. Hi Venkat,

    This seems to be an issue with the classpath .
    Can you check the classpath variable of the prompt from where you are executing command : nmStrart('AdminServer')
    The issue seems to be with the "c:/program files " dir placed in the either classpath or path variable.
    As there is a space between the file name , the issue is there .

    Try to use double quotes (") .

    please paste the values of the variables : CLASSPATH and PATH of the command prompt from where you are executing the nmStart() .

    Thanks,
    Sandeep

    ReplyDelete