Friday, June 22, 2012

Setting Up Oracle WebLogic Server Startas a Windows Service



Create weblogic as a windows service

By making entry in windows registry we can create weblogic server instance as windows service. To do this, we need to create a script which will have weblogic server-specific variables like domain name, server name, etc. This script calls master script called installSvc.cmd(${bea_dir}\wlserver_10.3\server\bin).

Here are the steps:
1. Go to${bea_dir}\wlserver_10.3\server\bin where bea_dir is home directory of weblogic installation.

2. Create a file called createSvc.cmd with following values: please make sure you mention the right domain name, path and admin server instance name. Also check the path of installSvc.cmd it varies from one version to other.
    echo off
    SETLOCAL
    set DOMAIN_NAME=sampleDomain
    set USERDOMAIN_HOME=c:\bea\user_projects\domains\sampleDomain
    set SERVER_NAME=Adminserver_name
    set PRODUCTION_MODE=false
    set JAVA_VENDOR=Sun
    set JAVA_HOME=C:\bea\jdk160_05
    set MEM_ARGS=-Xms256m -Xmx512m
    call "c:\bea\wlserver_10.3\server\bin\installSvc.cmd"
    ENDLOCAL

3. Execute createSvc.cmd script from same folder c:\bea\wlserver_10.3\server\bin\

4. This should create service with name of "beasvc sampleDomain_Adminserver_name" in the registry under HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services

5. Also, if you go to services under Control panel, you should see the service with above name. Click the service to start. If you don't see it, there is some problem or sure. Check the path of domain and other variables in createSvc script.

6. Also if there is an issue with start up, you may check the Admin server logs under domain.
Good luck. Let me know  if you are running into any issues.

How to change the default service name? 
As you know this script internal calls installSvc.cmd to create a windows service, this will prefix default "beasvc domain_name Adminserver....". To remove this prefix and have a custom service name, edit installSvc.cmd and look for beasvc and change the name you wanted to.
"%WL_HOME%\server\bin\beasvc" -install -svcname:"beasvc %DOMAIN_NAME%_%SERVER_NAME%" -javahome:"%JAVA_HOME%" -execdir:"%USERDOMAIN_HOME%" -maxconnectretries:"%MAX_CONNECT_RETRIES%" -host:"%HOST%" -port:"%PORT%" -extrapath:"%EXTRAPATH%" -password:"%WLS_PW%" -cmdline:%CMDLINE%

How to remove server instance as a windows service:
Create a script called removeSvc.cmd and copy the following lines. Make sure adminServer name & domain name values are correctly set. And execute from the same place(c:\bea\wlserver_10.3\server\bin) where you created window service before.

echo off
SETLOCAL
set DOMAIN_NAME=sampleDomain
set SERVER_NAME=AdminServer
call "c:\bea\wlserver_10.3\server\bin\uninstallSvc.cmd"
ENDLOCAL

P.S: The name should be matching with the name given at the time of creating service in installSvc.cmd.

1 comment:

  1. I really appreciate information shared above. It’s of great help. If someone want to learn Online (Virtual) instructor lead live training in Oracle Weblogic Server, kindly contact us http://www.maxmunus.com/contact
    MaxMunus Offer World Class Virtual Instructor led training on Oracle Weblogic Server. We have industry expert trainer. We provide Training Material and Software Support. MaxMunus has successfully conducted 100000+ trainings in India, USA, UK, Australlia, Switzerland, Qatar, Saudi Arabia, Bangladesh, Bahrain and UAE etc.
    For Demo Contact us.
    Nitesh Kumar
    MaxMunus
    E-mail: nitesh@maxmunus.com
    Skype id: nitesh_maxmunus
    Ph:(+91) 8553912023
    http://www.maxmunus.com/




    ReplyDelete