Pythian Blog: Technical Track

How to Configure WebLogic as a Windows Service (in Just 4 Steps)

When you install WebLogic Server on the Windows platform, it might be a good idea to set it as a native Windows Service.

The standard installation deploys the underlying scripts to create and uninstall the WebLogic server process as a Windows Service.

With the following example, you could register and run the following components:

  1. AdminServer
  2. NodeManager
  3. Managed Servers
    1. WLS_FORMS
    2. WLS_REPORTS

Adjust the variable values for your own runtime requirements and run the Command Prompt (cmd) as Administrator.

1. Start a terminal as Administrator and type the following to register the AdminServer server process service.

Note: A hardcoded WebLogic administrator password is required.

C:\> 
SETLOCAL
set DOMAIN_NAME=base_domain
set USERDOMAIN_HOME=C:\oracle\Middleware\user_projects\domains\base_domain
set SERVER_NAME=AdminServer
set WL_HOME=C:\oracle\Middleware\wlserver
set PRODUCTION_MODE=true
set WLS_USER=weblogic
set WLS_PW=password
set MEM_ARGS=-Xms128m -Xmx512m
call "C:\oracle\Middleware\user_projects\domains\base_domain\bin\setDomainEnv.cmd"
call "C:\oracle\Middleware\wlserver\server\bin\installSvc.cmd"
ENDLOCAL

2. Start a terminal as Administrator and type the following to register the NodeManager service.

Note: A hardcoded WebLogic administrator password is required.

C:\> 
SETLOCAL
set DOMAIN_NAME=base_domain
set WL_HOME=C:\oracle\Middleware\wlserver
set PRODUCTION_MODE=true
set WLS_USER=weblogic
set PASSWORD=password
set JAVA_HOME=C:\oracle\jdk1.8.0_361
set USER_MEM_ARGS=-Xms128m -Xms128m
call "C:\oracle\Middleware\user_projects\domains\base_domain\bin\setDomainEnv.cmd"
call "C:\oracle\Middleware\wlserver\server\bin\installNodeMgrSvc.cmd"
ENDLOCAL

3. Start a terminal as Administrator and type the following to register the WLS_FORMS service.

Note: A hardcoded WebLogic administrator password is required.

C:\> 
SETLOCAL
set JAVA_HOME=C:\oracle\jdk1.8.0_361
set DOMAIN_NAME=base_domain
set USERDOMAIN_HOME=C:\oracle\Middleware\user_projects\domains\base_domain
set SERVER_NAME=WLS_FORMS
set PRODUCTION_MODE=true
set ADMIN_URL=http://localhost:7001
set WLS_USER=weblogic
set WLS_PW=password
set MEM_ARGS=-Xms512m -Xmx1024m
cd %USERDOMAIN_HOME%
call "C:\oracle\Middleware\user_projects\domains\base_domain\bin\setDomainEnv.cmd"
call "C:\oracle\Middleware\wlserver\server\bin\installSvc.cmd"
ENDLOCAL

4. Start a terminal “as administrator” and type the following to register the WLS_REPORTS service.

Note: A hardcoded WebLogic administrator password is required.

C:\> 
SETLOCAL
set JAVA_HOME=C:\oracle\jdk1.8.0_361
set DOMAIN_NAME=base_domain
set USERDOMAIN_HOME=C:\oracle\Middleware\user_projects\domains\base_domain
set SERVER_NAME=WLS_REPORTS
set PRODUCTION_MODE=true
set ADMIN_URL=http://localhost:7001
set WLS_USER=weblogic
set WLS_PW=password
set MEM_ARGS=-Xms512m -Xmx1024m
cd %USERDOMAIN_HOME%
call "C:\oracle\Middleware\user_projects\domains\base_domain\bin\setDomainEnv.cmd"
call "C:\oracle\Middleware\wlserver\server\bin\installSvc.cmd"
ENDLOCAL

The negative part here is that Windows will try to start all the services randomly and “at the same time.” There is no easy way to specify the order and the delay—like starting the managed server processes after the AdminServer.

If there are specific requirements to set the order, it is possible to set a delay.

Before running the step for the specific server process component, manually edit the installSvc.cmd script and add a -delay parameter for the wlsvc call (in milliseconds).

An example from the documentation (120 seconds):

"%WL_HOME%\server\bin\wlsvc" -install
-svcname:"%DOMAIN_NAME%_%SERVER_NAME%"
-delay:120000
-javahome:"%JAVA_HOME%" -execdir:"%USERDOMAIN_HOME%"
-extrapath:"%WL_HOME%\server\bin" -password:"%WLS_PW%"
-cmdline:%CMDLINE%

If everything goes smoothly, the following services will be available on services.msc.:

  • wlsvc base_domain_AdminServer
  • OracleWebLogic NodeManager (C_oracle_Middleware_wlserver)
  • wlsvc base_domain_WLS_FORMS
  • wlsvc base_domain_WLS_REPORTS

I hope this guide helped you quickly configure WebLogic as a Windows Service—let me know if you have any questions.

Cheers.

No Comments Yet

Let us know what you think

Subscribe by email