Thursday, June 7, 2018

Deploying Weblogic Admin service as a Windows service


Best way to keep the Weblogic admin services up and running on windows server is by deploying it as a windows service. 

Need: If Weblogic is installed on windows server (in my case it is under D:\Oracle\Middleware\user_projects\domains\EPMSystem\bin for Hyperion installation) Admin services needs to be started using startWebLogic.cmd located under "bin" folder. To keep the services up and running command prompt which is used to start the service should be always remain open on the server which is not practically always possible. If the same service is deployed as windows service it can be well managed through windows service manager.


Steps to be perform:


  • Navigate to path D:\Oracle\Middleware\wlserver_10.3\server\bin
  • Create a file InstallAdminService.cmd and copy below content in the file (Update values as per environment):
***************************************

SETLOCAL
SET DOMAIN_NAME=EPMSystem
SET USERDOMAIN_HOME=D:\Oracle\Middleware\user_projects\domains\EPMSystem
SET SERVER_NAME=AdminServer
set WLS_USER=EPM_ADMIN
set WLS_PW=*******
SET PRODUCTION_MODE=true
SET JAVA_OPTIONS=-Dweblogic.Stdout="D:\Oracle\Middleware\user_projects\domains\EPMSystem\stdout.txt" -Dweblogic.Stderr="D:\Oracle\Middleware\user_projects\domains\EPMSystem\stderr.txt"
SET MEM_ARGS=-Xms1024m -Xmx1024m
CALL "D:\Oracle\Middleware\wlserver_10.3\server\bin\installSvc.cmd"
ENDLOCAL

***************************************



  • Navigate to D:\Oracle\Middleware\user_projects\domains\EPMSystem\bin and create a copy of setDomainEnv.cmd, rename the copied file as setSvcDomainEnv.cmd

  • Open setSvcDomainEnv.cmd in a text editor Search for PROTOCOL_HANDLERS and comment the 3 lines with PROTOCOL_HANDLERS 
Before modification: 



set PROTOCOL_HANDLERS=oracle.mds.net.protocol

set JAVA_PROPERTIES=%JAVA_PROPERTIES% -DEPM_ORACLE_HOME=%EPM_ORACLE_HOME% -DEPM_ORACLE_INSTANCE=%EPM_ORACLE_INSTANCE%

set PROTOCOL_HANDLERS=%PROTOCOL_HANDLERS%;oracle.fabric.common.classloaderurl.handler;oracle.fabric.common.uddiurl.handler;oracle.bpm.io.fs.protocol

set PROTOCOL_HANDLERS=%PROTOCOL_HANDLERS:;="|"%

            After modification:

@REM set PROTOCOL_HANDLERS=oracle.mds.net.protocol

set JAVA_PROPERTIES=%JAVA_PROPERTIES% -DEPM_ORACLE_HOME=%EPM_ORACLE_HOME% -DEPM_ORACLE_INSTANCE=%EPM_ORACLE_INSTANCE%

@REM set PROTOCOL_HANDLERS=%PROTOCOL_HANDLERS%;oracle.fabric.common.classloaderurl.handler;oracle.fabric.common.uddiurl.handler;oracle.bpm.io.fs.protocol


@REM set PROTOCOL_HANDLERS=%PROTOCOL_HANDLERS:;="|"%


  • Remove the following settings in the last ‘set EXTRA_JAVA_PROPERTIES’ in bold below -Djava.protocol.handler.pkgs=%PROTOCOL_HANDLERS% 


Before: 
set EXTRA_JAVA_PROPERTIES=-Dcommon.components.home=%COMMON_COMPONENTS_HOME% -Djrf.version=11.1.1 -Dorg.apache.commons.logging.Log=org.apache.commons.logging.impl.Jdk14Logger -Ddomain.home=%DOMAIN_HOME% -Djrockit.optfile=%COMMON_COMPONENTS_HOME%\modules\oracle.jrf_11.1.1\jrocket_optfile.txt -Doracle.server.config.dir=%ORACLE_DOMAIN_CONFIG_DIR%\servers\%SERVER_NAME% -Doracle.domain.config.dir=%ORACLE_DOMAIN_CONFIG_DIR%  -Digf.arisidbeans.carmlloc=%ORACLE_DOMAIN_CONFIG_DIR%\carml  -Digf.arisidstack.home=%ORACLE_DOMAIN_CONFIG_DIR%\arisidprovider -Doracle.security.jps.config=%DOMAIN_HOME%\config\fmwconfig\jps-config.xml -Doracle.deployed.app.dir=%DOMAIN_HOME%\servers\%SERVER_NAME%\tmp\_WL_user -Doracle.deployed.app.ext=\- -Dweblogic.alternateTypesDirectory=%ALT_TYPES_DIR% -Djava.protocol.handler.pkgs=%PROTOCOL_HANDLERS%  %WLS_JDBC_REMOTE_ENABLED% %EXTRA_JAVA_PROPERTIES%

After:
set EXTRA_JAVA_PROPERTIES=-Dcommon.components.home=%COMMON_COMPONENTS_HOME% -Djrf.version=11.1.1 -Dorg.apache.commons.logging.Log=org.apache.commons.logging.impl.Jdk14Logger -Ddomain.home=%DOMAIN_HOME% -Djrockit.optfile=%COMMON_COMPONENTS_HOME%\modules\oracle.jrf_11.1.1\jrocket_optfile.txt -Doracle.server.config.dir=%ORACLE_DOMAIN_CONFIG_DIR%\servers\%SERVER_NAME% -Doracle.domain.config.dir=%ORACLE_DOMAIN_CONFIG_DIR%  -Digf.arisidbeans.carmlloc=%ORACLE_DOMAIN_CONFIG_DIR%\carml  -Digf.arisidstack.home=%ORACLE_DOMAIN_CONFIG_DIR%\arisidprovider -Doracle.security.jps.config=%DOMAIN_HOME%\config\fmwconfig\jps-config.xml -Doracle.deployed.app.dir=%DOMAIN_HOME%\servers\%SERVER_NAME%\tmp\_WL_user -Doracle.deployed.app.ext=\- -Dweblogic.alternateTypesDirectory=%ALT_TYPES_DIR%  %WLS_JDBC_REMOTE_ENABLED% %EXTRA_JAVA_PROPERTIES%




  • Save the changes to setSvcDomainEnv.cmd file
  • Run InstallAdminService.cmd to create the windows service.