When you get the oracle coherence bit,there is one bootstrap file located in coherence\bin\cache-server.cmd , when you run that , a command prompt will show up. and you need keep it open otherwise the clustering service will be closed. So how to make it runs as a windows service?
Here is the steps to install it as a windows service, so the cluster service will be started up when the machine boot up.
1. Get the Parameters to run the Java Application. when you start up the bat file, the runtime will fire up one jave process with giving parameters. you need get those parameters.
how to get the parameters on windows, If you runs on windows vista or 7 or 2008. just right click the taskmanager, turn on the commandline column by selecting View->select Columns->Command Line.
for windows Xp ,or 2003. you can get this by querying the WMI
Run WMIC on the command prompt, and key in “process where name=”java.exe” get commandline”
so for this example the full commandline is .
|full commandline||"c:\jdk1.6.0_20\bin\java" -server -showversion ""-Xms512m -Xmx512m"" -cp "C:\tangosol-33\coherence\bin\\..\lib\coherence.jar" com.tangosol.net.DefaultCacheServer|
|jvm parameters||-server -showversion ""-Xms512m -Xmx512m""|
2. download the javaservice . http://forge.ow2.org/project/showfiles.php?group_id=137&release_id=1560
please note, if your using 64 bit jvm, chose the amd64 zip version of javaservice. then unzip the file, copy the javaservice.exe to the coherence\bin folder. you may rename it as coherence.exe.
3. install one windows service by assign the paramters to coherence.exe.
C:\tangosol-33\coherence\bin>coherence.exe -install MyServiceName "C:\jdk1.6.0_20\jre\bin\server\jvm.dll" -server -showv
then you will be able to see a service named myservicename in services console.
4. troubleshooting. you may get error to startup the service. always check the following list.
- Windows Event Log, if you mess up the jvm 32/64 version, you may get the error like
“LoadLibrary is not a valid Win32 application.” which means you jdk is 32bit, but javaservice is 64 bit.
- check the error log file that you specified in the –err parameter.
- you may tweak the parameters, which is located in HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\services\MyServiceName
just change those parameters directly, then restart the service see whether the error will disappear
hope it helps.
Oracle coherence: http://www.oracle.com/technology/products/coherence/index.html
Oracle coherence Book, great book from the core team