Wednesday, June 27, 2012

How to 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
    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"

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%

No comments:

Post a Comment