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

39 comments:

  1. 2 points:

    1) setting StartScriptEnabled and StopScriptEnabled to true are not mandatory here. they are supposed to be used to run some scripts before weblogic's started/after weblogic's shut down.

    SOA might need it but it's not required here.

    2)nmEnroll() is required to register the domain before nmConnect() can be called. Dynamic domain registration is not supported.

    ReplyDelete
  2. Hi,

    You are right for plain java weblogic servers, in that case you can also make a windows service with the utility provided by wls
    But nowadays for FMW , everything is put in the start scripts and fmw is big

    NmEnroll is not required , when you create a new domain in the same middleware home as the nodemanager then you only need to restart the nodemanager and the new domain is detected

    Thanks

    ReplyDelete
  3. Hi Edwin,
    nmConnect('weblogic','yourpassword','localhost','5556','wls_domain','C:/XXX/user_projects/domains/wls_domain','ssl')
    Here what is wls_domain ,actually I have soadomain1 under user_projects/domains.I did as it is you mentioned but I skip the above line and I successfully started the AdminServer using nmStart('AdminServer') but I can't able to start the soa_server1 using nmStart('soa_server1') and I got the following error:
    Error Starting server soa_server1: weblogic.nodemanager.NMException: Exception w
    hile starting server 'soa_server1'
    can you give me the solution please.
    Regards,
    Prasad.

    ReplyDelete
  4. Hi,

    I think you got an error while starting, can you check the log files of the soa_server1.

    Probably you didn't create a boot.properties file in the security folder.
    and then its waiting for your input.

    or you didn't set stop and startScriptEnabled on true in the nodemanager.properties and restart the nodemanager.

    thanks

    ReplyDelete
  5. I was searching on google and directed to this blog. I found it very informative. There are some very useful examples. Great work, Keep it up.

    ReplyDelete
  6. Hi,
    good information. but it's not working for me. Could you help please? I tried start managed server osb_server1. got error after nmStart('osb_server1')
    Error Starting server osb_server1: weblogic.nodemanager.NMException: Exception w
    hile starting server 'osb_server1'.
    nodemanager.log is:
    <9/12/2011 12:26:53 PM>
    <9/12/2011 12:26:53 PM>
    <9/12/2011 12:26:53 PM>
    <9/12/2011 12:26:53 PM>
    <9/12/2011 12:26:53 PM>
    <9/12/2011 12:26:53 PM>
    <9/12/2011 12:26:53 PM>
    <9/12/2011 12:26:54 PM>
    <9/12/2011 12:26:54 PM>
    java.io.IOException: Server failed to start up. See server output log for more details.
    at weblogic.nodemanager.server.AbstractServerManager.start(AbstractServerManager.java:200)
    at weblogic.nodemanager.server.ServerManager.start(ServerManager.java:23)
    at weblogic.nodemanager.server.Handler.handleStart(Handler.java:604)
    at weblogic.nodemanager.server.Handler.handleCommand(Handler.java:119)
    at weblogic.nodemanager.server.Handler.run(Handler.java:71)
    at java.lang.Thread.run(Thread.java:662)

    any idea? thanks

    Kevin

    ReplyDelete
  7. here is osb_server1 log is:
    FATAL ERROR in native method: JDWP No transports initialized, jvmtiError=AGENT_ERROR_TRANSPORT_INIT(197)
    ERROR: transport error 202: bind failed: Address already in use
    ERROR: JDWP Transport dt_socket failed to initialize, TRANSPORT_INIT(510)
    JDWP exit error AGENT_ERROR_TRANSPORT_INIT(197): No transports initialized [../../../src/share/back/debugInit.c:690]
    <9/12/2011 12:26:54 PM>
    <9/12/2011 12:26:54 PM>
    <9/12/2011 12:26:54 PM>

    thanks

    Kevin

    ReplyDelete
    Replies
    1. You are running two WLS instances (probably AdminServer and osb_server1) in Development mode on the same machine. This causes the jvm to start up in debug mode and trying to connect to the same debug port for all instances. Only on WLS instances can run in debug mode on the same machine at the same time.

      To fix this, either edit the startWebLogic.sh script to pass the "nodebug" argument explicitly to the setDomainEnv.sh script (this will turn off jvm debug mode for all WLS instances on the machine), or start the AdminServer by calling startWebLogic.sh on the commandline with "nodebug" as an argument (this will let osb_server1 start up in jvm debug mode when starting from nodemanager).

      Both of these methods will preserve all other development benefits of running the domain in Development mode, just the jvm debug mode will be affected.

      Delete
  8. Hi,

    Can you check the following.

    Can you start it with startManaged script.
    Set the boot.properties and set the stop and script enabled in the nodemanager.properties.

    First start it once from the weblogic console.
    and maybe enroll the domain again.

    thanks

    ReplyDelete
  9. Estimado Edwin,

    Buenas tardes requiero de tu apoyo con el tema de iniciar automáticamente el servicio del weblogic en el Sistema operativo Windows, por ejemplo si en caso de reiniciar mi maquina o apagar y volver a prenderla que siempre se inicie el servicio del Weblogic automáticamente, requiero de esa solución, eh tratado de hacer por varias formas lo cual no llego a lo requerido, estuve revisando tu Blog y me parece que tu podrías tener la solución y así poder compartírmela.

    Gracias
    Saludos Cordiales

    ReplyDelete
  10. Hi guys,

    I have a question...
    When setting HA for SOA Stack, recommends to have shared storage for adminServer and local storage for managedServer:
    /u01/app/oracle/admin/osb-domain/aserver/osb-domain respectively /u01/app/oracle/admin/osb-domain/mserver/osb-domain. The NodeManager nodemanager.domains file contains the following entry osb-domain=/u01/app/oracle/admin/osb-domain/mserver/osb-domain and in this case I can use NodeManager only for the ManagedServer and not for AdminServer.
    There is any workaround for this?

    ReplyDelete
  11. Great article! I have successfully set up WLST and related CMD scripts to start my admin server and a managed server, which run perfectly when I'm logged into my Windows Server 2003 R2 box. Unfortunately, when I set up Windows scheduled tasks to run the CMD script at system startup, the scheduled task fails. I have tried running the scheduled tasks with server admin credentials as well as NT AUTHORITY\SYSTEM.

    Have you had any luck running your scripts with a Windows scheduled task? Any ideas what might be going wrong with my scheduled tasks?

    ReplyDelete
    Replies
    1. Hi,

      do you of The nodemanager is already up, maybe it is some kind of sandbox protected error and do you get a error. I know starting with a windows service works.

      Thanks

      Delete
    2. Nodemanager starts up as a Windows service whenever the server starts. I think I have tried a version of the CMD script that included a SLEEP at the start, which didn't work, might try again. For now I am only trying to get the scheduled task to start the admin server to simplify things. No significant error messages except for:

      0x1 in the "Last Result" column of the scheduled task window ("an incorrect function was called or an unknown function was called" according to Microsoft documentation).

      Separately, I have been able to start the admin server as a windows service according to Oracle documentation, but then I don't think I can use nodemanager to control the server.

      Delete
    3. Apparently I had some problems with my CMD file syntax. The following CMD file successfully starts up the admin server (if it's not already running) 5 minutes after machine startup when using a Windows Server 2003 scheduled task. The timeout takes care of the 5 minute delay. The DOMAIN_HOME path and WL_HOME path will depend on your installation. The startAdminServer.wlst filename will be whatever you called your wlst script. A variation on this works for my managed servers also so long as the admin server starts first.

      SETLOCAL
      timeout /t 300
      set DOMAIN_HOME=C:\Oracle\Middleware\user_projects\domains\your_domain
      set WL_HOME=C:\Oracle\Middleware\wlserver_12.1
      call "%WL_HOME%\common\bin\wlst.cmd" "%DOMAIN_HOME%\startAdminServer.wlst"
      ENDLOCAL

      Delete
  12. Hi Edwin,

    I need urgent help from you. I have configured the nodemanager according to your mentioned steps and i am facing problem in starting soa_server1 through node manager. My OS is windows 7 64-bit.

    Nodemanager log file shows me the following error:-










    java.io.IOException: Server failed to start up. See server output log for more details.
    at weblogic.nodemanager.server.AbstractServerManager.start(AbstractServerManager.java:196)
    at weblogic.nodemanager.server.ServerManager.start(ServerManager.java:23)
    at weblogic.nodemanager.server.Handler.handleStart(Handler.java:609)
    at weblogic.nodemanager.server.Handler.handleCommand(Handler.java:119)
    at weblogic.nodemanager.server.Handler.run(Handler.java:71)
    at java.lang.Thread.run(Thread.java:662)


    ReplyDelete
  13. Hi Edwin

    I followed all of your instructions, but it seems that I can't get the Admin Server to start. When the machine starts, a command line appears with a bunch of lines, with the last one saying: "Initializing Weblogic scripting tool (WLST) ...". After a few seconds, the command line disappears but after that, nothing happens.

    Can you please help me?
    Thanks in advance

    ReplyDelete
    Replies
    1. Hi,

      can you check all the logs of the nodemanager and the adminserver. plus manually start the nodemanager.

      there must be some error.

      Delete
  14. Hi

    It's already resolved. Just put the scripts in the same folder of wlst.cmd file and that's it.

    Thanks for your reply.

    ReplyDelete
  15. Hi,

    Sub: ./startManagedWeblogic.sh soa_server1 fails

    We are setting up an OIM 11g R2 environment, and we have 2 Middleware homes,over the RHEL6.4

    Middleware1 for OUD
    Middleware2 for OIM, OAM components

    Database has been installed on a different server(s), which is on Active - Passive mode.

    We had completed the OUD and ODSM part, and is good, over the Middleware1

    When started to perform the OUI configuration, it mandated the SOA server start. we run the command ./startManagedWeblogic.sh soa_server1 from the Middleware2 path under the base_domain/bin. it fails with the errors codes as below

    &


    Please advice.

    ReplyDelete
    Replies
    1. Hi,

      I can't see the output, can you escape it.
      But there can be a problem with the nodemanager, you can try to enroll the domain, probably you need to set start and stop script enabled in the nodemanager.properties, or you need to add boot.properties with the credentails or some datasource problem.

      Thanks

      Delete
  16. Hi Edwin,
    I am trying to configure Node Manager to start all AdminServer and Managed server just by lunching the StartNodeManager.sh script provided par installtion. is this possble without any change in the script ?

    Node manager is supposed to do that, start all servers that are attached to it, just by lunching the StartNodeManager.sh script , No ?

    regards

    hassan

    ReplyDelete
    Replies
    1. Hi,

      I think you need to create a nodemanager service and with a higher startup sequence a second service which connects to the nodemanager which start the all the managed servers. ( manual configuration )

      you can't know what are the possible managed servers to start, you can only connect to the adminserver ( with WLST or JMX ) and read all the servers which have that nodemanager as machine.

      thanks


      Delete
  17. Hi,
    It clarify what can node manager do to start automatically managed servers when machine reboot.

    thanks.

    ReplyDelete
    Replies
    1. If they are already started and you enable crash recovery on the nodemanager then with a reboot the nodemanager will also start the managed servers

      Thanks

      Delete
  18. Hi Edwin,

    I followed all the steps but i am also getting the same error:

    Error Starting server soa_server1: weblogic.nodemanager.NMException: Exception w
    hile starting server 'soa_server1'

    ReplyDelete
  19. Hi,

    Can we use single node manager to manage managed servers from two different versions of weblogic in same machine (10.3.5 and 10.3.0)? how to do this?

    Regards,
    Sridhar

    ReplyDelete
    Replies
    1. Hi,

      Indeed this is possible, just do an enroll from wlst to the nodemanager with the right domain path plus maybe use scriptenabled = true.

      thanks

      Delete
  20. Resolution to the problem:

    For this mainly you need to set the debugFlag=false or you can just remove it in setDomainEnv.cmd in windows environment

    This Problem mainly happens to nodemanager because nodemanager want to start the soa_server1 also using the same port. thats why problem comes.

    ReplyDelete
  21. My Node Manager is still offline after putting in these parameters nmConnect('weblogic','yourpassword','localhost','5556','PRIMAVERAP6EPPM','C:/ORACLE/Middleware/user_projects/domains/PRIMAVERAP6EPPM','ssl')

    it then starts with connection to node manager and after it fails and goes back to offline.
    Please what do I do

    ReplyDelete
    Replies
    1. if you use nmConnect , your nodemanager should be started and listen on localhost with 5556 as port.

      so manually start your nodemanager first

      Delete
  22. Hi Edwin,
    I have two questions.

    What directory do I save the StartDomain.wlst to?

    Can you add lines to the StartDomain.cmd to start the Node Manager, both the windows service and the StartNodeMannger.cmd?......I want to start everything with one click......

    ReplyDelete
  23. Hi

    I am getting interactive services detection error in my system. and also startManagedWebLogic.cmd log showing some warning messages like below



    Kindly help me to solve this issue.............

    ReplyDelete
  24. Hello Everyone, I am having strange issue...any insight or help please.
    I am trying to start AdminServer with WLST. The script is able to start AdminServer
    The PROBLEM: after starting AdminServer, the command nmStart('AdminServer') never exists with successful message ( which is expected) But when I look at AdminServer logs .. it is in RUNNING mode and I can see the proccess and can login to console. The next step in the script is to check status of admin server and if RUNNING start managed server. But since nmStart('AdminServer') never exits, I am stuck at the point....again if I restart the script, AdminServer status is Starting..even though it is in RUNNING Mode.

    The screen shots:
    Successfully Connected to Node Manager.
    <<>>Status of node manager:
    Currently connected to Node Manager to monitor the domain idmdomain.
    <<>>current status of AdminServer:

    UNKNOWN

    <<>>starting server AdminServer...
    Starting server AdminServer ...
    .....
    NMProcess: INFO: Server output log file is '/app/weblogic/domains/idmdomain/servers/AdminServer/logs/AdminServer.out' (HANGS HERE-->Does not exit...no errors in AdminServer.out and is in RUNNING MODE and I can login to Console)


    If I try to re-run the wlst script I get:
    Successfully Connected to Node Manager.
    <<>>Status of node manager:
    Currently connected to Node Manager to monitor the domain idmdomain.
    <<>>current status of AdminServer:

    STARTING

    wait until AdminServer becomes RUNNING

    STARTING

    ReplyDelete
    Replies
    1. Hi ,

      We are having the same issue .How did you resolve this issue

      It would be great if you can share the solution .

      Thanks

      Delete
    2. Hi ,

      We are having the same issue .How did you resolve this issue

      It would be great if you can share the solution .

      Thanks

      Delete
  25. Hi Edwin,

    We have recently migrated the server to new Windows domain. We still have the old windows domain user. When I am trying to start the adminserver with newly joined windows domain user after logged into this user account with administrator privileges its not starting, whereas with old domain user its starting. Can you kindly help me with this. In near future we will remove the old domain users then it will be bigger issue to start the UCM services.

    Thanks and Regards,
    lpathi

    ReplyDelete
  26. Hi Edwin,

    We have migrated our oracle webcenter server to different windows domain controller, it has
    still the old domain users. When I logged with new domain user and trying to start the AdminServer its not
    starting. If I logged with old domain user its starting the AdminServer, node manager and UCM.
    Can you kindly suggest where I can look into?

    Thanks and Regards,
    Lpathi

    ReplyDelete