Although this should not be so complicated I run into some problems I would like to share in this post. In general it is quit simple to generate a window service that starts a weblogic server. If you read the manual you see you need to create a script that sets some environment variables and finally calls the %WL_HOME%\server\bin\installSvc.cmd script to do the actual creation of the Windows NT Service. Here you can see a sample (I will call this script installAdminServerSvc.cmd)
@echo off SETLOCAL set DOMAIN_NAME=SOA_DOMAIN set USERDOMAIN_HOME=D:\Oracle\Middleware11gR1PS3\user_projects\domains\SOA_DOMAIN set SERVER_NAME=AdminServer set PRODUCTION_MODE=false set WLS_USER=weblogic set WLS_PW=welcome1 set JAVA_OPTIONS=-Dweblogic.Stdout="D:\Oracle\Middleware11gR1PS3\user_projects\domains\SOA_DOMAIN\AdminServer-stdout.txt" -Dweblogic.Stderr="D:\Oracle\Middleware11gR1PS3\user_projects\domains\SOA_DOMAIN\AdminServer-stderr.txt" set JAVA_VM=-client set MEM_ARGS=-Xms40m -Xmx250m set MAX_CONNECT_RETRIES=3 set HOST=localhost set PORT=7001 call "D:\Oracle\Middleware11gR1PS3\wlserver_10.3\server\bin\installSvc.cmd" ENDLOCAL
You need to make one change to the %WEBLOGIC_HOME%\server\lib\installSvc.cmd script file.
The script will now use the right script to set the environment variables: setDomainEnv.cmd instead of the default commEnv.cmd.
......... @echo off SETLOCAL set WL_HOME=D:\Oracle\Middleware11gR1PS3\wlserver_10.3 rem call "%WL_HOME%\common\bin\commEnv.cmd" call "%USERDOMAIN_HOME%\bin\setDomainEnv.cmd" @rem Check that the WebLogic classes are where we expect them to be :checkWLS .......
So far so good. But when you run installAdminServerSvc.cmd you will get an error:
‘”oracle.fabric.common.classloaderurl.handler”‘ is not recognized as an internal
or external command, operable program or batch file.
This approach always worked until now. So what changed here? After some browsing through the scripts I found the problem.
In the new version of the setDomainEnv.cmd the property PROTOCOL_HANDLERS is set to five protocol handlers concatenated together by a pipe (“|”): oracle.mds.net.protocol”|”oracle.fabric.common.classloaderurl.handler”|”oracle.fabric.common.uddiurl.handler”|”oracle.bpm.io.fs.protocol. This property is assigned to JAVA_OPTIONS which is used again in the installSvc.cmd script when setting the CMDLINE property. When I display (echo) the content of this property I see the following (I shortened the content somewhat):
set CMDLINE=”-client -Xms512m -Xmx1024m -XX:PermSize=128m -XX:MaxPermSize=512m -Dweblogic.Stdout=”D:\Oracle ….. -Djava.protocol.handler.pkgs=oracle.mds.net.protocol” | “oracle.fabric.common.classloaderurl.handler” | “oracle.fabric.common.uddiurl.handler” | “oracle.bpm.io.fs.protocol ……. weblogic.Server”
As you can see there are additional spaces added between the protocol handler packages now. This causes the problem. As the previous version only assigned one protocol handler package this problem never occured until now.
Since I have no influence on adding spaces I have done the following. I changed the setting of the CMDLINE property from its orginal form:
set CMDLINE=”%JAVA_VM% %MEM_ARGS% %JAVA_OPTIONS% -classpath \”%CLASSPATH%\” -Dweblogic.Name=%SERVER_NAME% -Dweblogic.management.username=%WLS_USER% -Dweblogic.ProductionModeEnabled=%PRODUCTION_MODE% -Djava.security.policy=\”%WL_HOME%\server\lib\weblogic.policy\” weblogic.Server”
to its substituted form (I of course removed the spaces):
set CMDLINE=”-client -Xms512m -Xmx1024m -XX:PermSize=128m -XX:MaxPermSize=512m -Dweblogic.Stdout=”D:\Oracle ….. -Djava.protocol.handler.pkgs=strong>oracle.mds.net.protocol|oracle.fabric.common.classloaderurl.handler|oracle.fabric.common.uddiurl.handler|oracle.bpm.io.fs.protocol ……. weblogic.Server”
Now the creation of the windows NT service did work.
MOS note 1060058.1
Firstly some MS Windows 64bit specific advice
If you are using MS Windows 64bit, edit the MIDDLEWARE_HOME\wlserver_10.3\server\bin\installSvc.cmd
If the WebLogic Domain is using Sun JDK, add “set JAVA_VM=-server”,
if the WebLogic Domain is using JRockit, add “set JAVA_VM=”-jrockit”
Example for Domain based on Sun JDK:
set JAVA_VM=-server if "%ADMIN_URL%" == "" goto runAdmin set CMDLINE="%JAVA_VM% %MEM_ARGS% %JAVA_OPTIONS% -classpath \"%CLASSPATH%\" -Dweblogic.Name=%SERVER_NAME% -Dweblogic.management.username=%WLS_USER% -Dweblogic.management.server=\"%ADMIN_URL%\ etc..
If the JAVA_VM mode is not changed from the default ‘-client’ to ‘-server’ the WebLogic Managed Server will fail to start as a MS Windows Service.
Thank you for your comment. I added what you meant to this post.
If you’re using 64-bit software, be sure to check out MOS note 1060058.1 as well – it has some additional steps!