Running HornetQ as a windows service
hughbragg Sep 13, 2010 2:40 AMI've been trying to get this to run for ages now and run into a lot of problems.
Attempt 1: Someone here has a VB.Net service runner that installs a service and stops it.
I wrote a few scripts and it worked... BUT:
The jmx console isn't accessible locally. It's there but jconsole or another program can't access it since they can't find how the program's main entry point is so all I see is the pid greyed out. same in the new jvisualvm.
Attempt 2: Use tomcats service installer with jdk x64. After some considerable experimentaions I created this script (WIP, see bellow):
BUT: java x64 has issues and I couldn't get the right dlls to load
Attempt 3: Use tomcat service installer with jdk x86.
setlocal ENABLEDELAYEDEXPANSION
rem Start HornetQ using the profile1
set HORNET_BASE=C:\Apps\HornetQ
set HORNET_HOME=%HORNET_BASE%\hornetq-2.1.2.Final
set HORNET_BIN=%HORNET_HOME%\bin
set APP_HOME=%HORNET_BASE%\Profile1
set APP_DATA=%APP_HOME%\data
set CLASSPATH=%APP_HOME%;%HORNET_HOME%\schemas\
for /R %HORNET_HOME%\lib %%A in (*.jar) do (
SET CLASSPATH=!CLASSPATH!;%%A
)
set JVM_ARGS=-XX:+UseParallelGC;-XX:+AggressiveOpts;-XX:+UseFastAccessorMethods;-Dhornetq.config.dir=%APP_HOME%;-Ddata.dir=%APP_DATA%;-Djava.util.logging.config.file=%APP_HOME%\logging.properties;-Djava.library.path=%HORNET_BIN%
%APP_HOME%\tomcat6-x86.exe //IS//HornetProfile1 --Install=%APP_HOME%\tomcat6-x86.exe --Description="HornetQ Profile1 tc" --Jvm=auto --Classpath=%CLASSPATH% --JvmMs512M --JvmMx1024M --JvmOptions="%JVM_ARGS%" --StartMode=jvm --StartClass=org.hornetq.integration.bootstrap.HornetQBootstrapServer --StartParams=hornetq-beans.xml --LogPath=%APP_HOME% --StdOutput=auto --StdError=auto
BUT: I when I startup the service I get this:
... javajni.c] [error] Static method 'void main(String[])' in Class org/hornetq/integration/bootstrap/HornetQBootstrapServer not found
[2010-09-13 16:28:52] [996 prunsrv.c] [error] Failed loading main org/hornetq/integration/bootstrap/HornetQBootstrapServer class ...
... prunsrv.c] [error] Failed loading main org/hornetq/integration/bootstrap/HornetQBootstrapServer ...
I have 2 question:
1. What is the entry point I should use in this script for Hornet (tomcat looks for main)?
2. Is there a better way to install multiple instances (or even 1 instance) of stand-alone non-clustered HornetQ as a windows service?