Implementing Oracle WebLogic AdminServer as Windows Service

Posted by Dirk Nachbar on Wednesday, May 11, 2011
Today my fight with the Oracle Internet Directory 11.1.1.4.0 from yesterday continues (http://dirknachbar.blogspot.com/2011/05/fighting-with-tns-03505-failed-to.html), but this time the problem were related to the Oracle WebLogic Server. I wanted to implement the startup of the underlying Oracle WebLogic AdminServer and ManagedServer of the Oracle Internet Directory installation as a Windows Service.

For this Oracle provides an installation script %WL_HOME%\server\bin\installSvc.cmd which should be called by a wrapper script which we have to create by ourself. (see http://download.oracle.com/docs/cd/E17904_01/web.1111/e13708/winservice.htm), but unfortunally if you follow this instruction, you will not be able to startup your AdminServer with a Windows Service. In the corresponding logfiles of the AdminServer you will find entries like:

<BEA-000286> <Failed to invoke startup class "JRF Startup Class" ...

After a little bit of Google Search, I found some articles, which point to the fact that a Java Class (ORACLE_COMMON\modules\oracle.jrf_11.1.1\jrf.jar) is missing in the CLASSPATH variable. So I try this, therefore I modified the %WL_HOME%\common\bin\commEnv.cmd which will be called in the installSvc.cmd and added the fullpath including the jar-file name to the variable WEBLOGIC_CLASSPATH. BIG MISTAKE :-) I did this, and re-created the Windows Service for the WebLogic AdminServer newly and try to startup the new Windows Service. This time I got new and strange exceptions . . .

After some investigations and testings I found a valid and working way, which is really simple :-)
At first in the %WL_HOME%\common\bin\commEnv.cmd I modify the line:

# Original:
@rem PRODUCTION_MODE, default to the development mode
set  PRODUCTION_MODE=
# To:
@rem PRODUCTION_MODE, default to the development mode
set  PRODUCTION_MODE=true

As in my case I am running in Production Mode and the declared variable in my wrapper script which calls the %WL_HOME%\server\bin\installSvc.cmd was not taken correctly and secondly I added one line in the %WL_HOME%\server\bin\installSvc.cmd script in order to call the %MW_HOME%\user_projects\domains\<YourDomain>\bin\setDomainEnv.cmd in which all necessary CLASSPATH declarations are included:

# Just add after the first call of the commEnv.cmd
# the call of your setDomainEnv.cmd
. . .
call "%WL_HOME%\common\bin\commEnv.cmd"
call "<YourMW_HOME>\user_projects\domains\<YourDomain>\bin\setDomainEnv.cmd"

After this changes just re-create your Windows Services for the WebLogic AdminServer newly, start the service up and be happy :-)