Running a WebLogic Portal (WLP) 10.3.4 Domain as a Windows Service

To start a WLP server as a Windows service it is simplest to make your own script based on the provided standard script located at WL_HOMEserverbininstallSvc.cmd. The standard script works fine for a plain WLS domain, but lacks some classpath and options necessary for WLP.

Start by making a copy of the installSvc.cmd script and naming it something specific to your domain.

Next, just under SETLOCAL you will find where WL_HOME is defined. Here you will add the definitions you would normally add in a script that later calls installSvc.cmd (as per the standard documentation).

set DOMAIN_NAME=gnma_test_domain
set USERDOMAIN_HOME=D:my_test_domain
set SERVER_NAME=AdminServer
set WLS_USER=weblogic
set WLS_PW=gnmaAdmin01
set PRODUCTION_MODE=true
set MEM_ARGS=-Xms512m –Xmx512m
set MW_HOME=C:OracleMiddleware

Note: I had heard of people using this approach who had issues with the length of the command line. This may be due to their use of the default domain path. In the example above, I use a shorter path.

At this point, edit the DOMAIN_HOMEbinstartWebLogic.cmd and set it to echo both the classpath and the options. Then start the domain and capture the output of those echoes, then shut the domain back down. Now REM out the existing CLASSPATH definition, then use the outputs you captured earlier to set the CLASSPATH and JAVA_OPTIONS like this:

REM set CLASSPATH=%WEBLOGIC_CLASSPATH%;%CLASSPATH%;
set CLASSPATH=%MW_HOME%patch_wls1034profilesdefault...
[REMAINING CLASSPATH SNIPPED TO FIT]

set JAVA_OPTIONS= -Xverify:none  -ea -da:com.bea...
[REMAINING CLASSPATH SNIPPED TO FIT]

Note that all absolute paths have been replaced with the definitions created earlier to keep the length down and make the script more portable. You should definitely make your own version rather than copying the above. If you do copy the above, be careful of extra spaces and carriage returns used for formatting this blog entry.

Finally, before the ENDLOCAL, add an uninstall line for later use:

rem call "%WL_HOME%serverbinuninstallSvc.cmd"

And that’s it. Looks really simple, but it took me quite some time to gather all the necessary pieces in order to make it work. Hopefully you find this before you went through half as much research.

The example here uses a domain with only the Admin server and no managed servers. For a variety of reasons I only want the Admin server to be run as a service. The standard documentation along with the example above should allow you to expand this to include managed servers should you feel the need.

If you found this interesting, please share.

© Scott S. Nelson

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.