Implementing Oracle WebLogic AdminServer as Windows Service
Posted by Dirk Nachbar on Wednesday, May 11, 2011 with 9 comments
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:
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:
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:
After this changes just re-create your Windows Services for the WebLogic AdminServer newly, start the service up and be happy :-)
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 :-)
I can't thank you enough!! I have been trying to solve this for 2 days! It simply worked!
ReplyDeleteHi Anonymous,
ReplyDeleteyou are welcome.
Cheers Dirk
Ditto. I was pulling what's left of my hair out. Thanks so much!
ReplyDeletewhat's the string length limit on SET CMDLINE?
ReplyDeleteI have SOA,OSB and BAM in my domain, and
%JAVA_OPTIONS% and %CLASSPATH% are very long,
so SET CMDLINE crash the InstallSvc script.
Thanks It really Worked.
ReplyDeleteThanks,
Seema
Thank you for the idea! I've added the call to the setDomainEnv within my harness script before the call to installSvc.cmd - and it works perfectly now!
ReplyDeleteRegards
Damon
You, sir, are a genius. Would be nice if Oracle's documentation had this tidbit.
ReplyDeleteAnonymous with the string length problem - make sure to reinstantiate all your variables each time you call the setDomainEnv script so it doesn't continue to append duplicate info to the end of all the paths.
Thanks a lot !
ReplyDeleteGood work. Why doesn't Oracle provide this solution - it's obviously a bug. Thank you.
ReplyDelete