Hi,

Jay SenSharma

Jay SenSharma

Many times we want to automate the Startup of our Servers sothat as soon as the Windows Operating System comes up it should itself start the WebLogic Server.  In order to achieve the same we need to configure our WebLogic Server as a Windows Service.

Note: If similar thing we want to achieve in Unix Based Operating Systems then we can configure the “rc” scripts.

Here is a 10 line script to configure and run your WebLogic Managed Server as Windows Service…
“makeWindowsService.cmd”

echo off
SETLOCAL
set DOMAIN_NAME=7001_Domain
set USERDOMAIN_HOME=d:bea103user_projectsdomains7001_Domain
set SERVER_NAME=myServerOne
set PRODUCTION_MODE=true
set
JAVA_OPTIONS=-Dweblogic.Stdout="c:bea103user_projectsdomains7001_Domain
stdout.txt" -Dweblogic.Stderr="d:bea103user_projectsdomains7001_Domain
stderr.txt"

set ADMIN_URL=http://adminserver:7001

set CLASSPATH=%JAVA_HOME%libtools.jar;%WL_HOME%serverlibweblogic_sp.jar;%WL_HOME%serverlibweblogic.jar;c:yourJarsDirabc.jar;%CLASSPATH%

set MEM_ARGS=-Xms1024m -Xmx1024m
call "C:bea103wlserver_10.3serverbininstallSvc.cmd"
ENDLOCAL


Note …if any chance you forget to mention the “set ADMIN_URL” in the above script then you will get the following error while starting your Managed Server Service …

<An error occurred while establishing a connection back to the adminstration server t3://140.126.24.25:6001 during startup. Since bootstrap succeeded check that t3://140.126.24.25:6001 uniquely identifies the administration server.
javax.naming.ServiceUnavailableException [Root exception is java.rmi.NoSuchObjectException: The object identified by: ’31’ could not be found. Either it was has not been exported or it has been collected by the distributed garbage collector.]

http://forums.oracle.com/forums/thread.jspa?messageID=4122542

Point 2)- Windows OS has a Classpath Length Limitation: Win32 systems have a 2K limitation on the length of the command line. If the classpath setting for the Windows service startup is very long, the 2K limitation could be exceeded.

-classpath @pathnamefilename

Example: C:myApplication>java -classpath C:myfilemyclasspath.txt;%classpath%  HelloWorld

Same thing you can use in your WindowsService Script as well.
.
.
.
Thanks
Jay SenSharma

If you enjoyed this post, please consider leaving a comment or subscribing to the RSS feed to have future articles delivered to your feed reader.