Hi all,
I need to use apache daemon to run Java class Foo on a 32-bit JVM that
runs on an AMD64 Windows machine.
I first do this
SET PRUNSRV=C:\commons-daemon-1.0.5-bin-windows\amd64\prunsrv.exe
and then installI Foo as follows:
%PRUNSRV% //IS//Foo ^
--Install="%PRUNSRV%" ^
--Startup=manual ^
--Classpath=... ^
--StartClass=Foo ^
--StartMethod=windowsService ^
--StopClass=Foo ^
--StopMethod=windowsService ^
--StartParams=start;... ^
--StopParams=stop ^
--StartPath=...
--StopPath=...
--Jvm="C:\jdk1.6.0_24\jre\bin\client\jvm.dll" ^
--JvmOptions=... ^
--JvmMs=... ^
--JvmMx=... ^
--StartMode=jvm ^
--StopMode=jvm ^
--StdOutput=auto ^
--StdError=auto ^
--LogPath=... ^
--LogPrefix=... ^
--LogLevel=DEBUG ^
--Environment=PATH=...
But when I try starting Foo I get the following:
[2011-06-22 12:10:55] [info] ( :0 ) Starting
service...
[2011-06-22 12:10:55] [debug] ( javajni.c:206 ) loading jvm
'C:\jdk1.6.0_24\jre\bin\client\jvm.dll'
[2011-06-22 12:10:55] [debug] ( javajni.c:251 ) Setting DLL
search path to 'C:\jdk1.6.0_24\jre\bin\client'
[2011-06-22 12:10:55] [debug] ( javajni.c:251 ) Setting DLL
search path to 'C:\jdk1.6.0_24\jre\bin'
[2011-06-22 12:10:55] [error] ( javajni.c:264 ) %1 is not a
valid Win32 application.
[2011-06-22 12:10:55] [error] ( prunsrv.c:1037) Failed creating
java C:\jdk1.6.0_24\jre\bin\client\jvm.dll
[2011-06-22 12:10:55] [error] ( prunsrv.c:1037) %1 is not a
valid Win32 application.
[2011-06-22 12:10:55] [error] ( prunsrv.c:1377) ServiceStart
returned 1
[2011-06-22 12:10:55] [error] ( prunsrv.c:1377) %1 is not a
valid Win32 application.
[2011-06-22 12:10:55] [info] ( :0 ) Run service
finished.
Having got nowhere trying to resolve this issue, and having run out of
ideas, I thought I'd try Installing the service the same way as above,
but with PRUNSRV set to the windows 32 version of prunsrv.exe, and to my
surprise, it worked:
[2011-06-23 09:57:52] [debug] ( prunsrv.c:1494) Commons Daemon
procrun log initialized
[2011-06-23 09:57:52] [info] ( :0 ) Commons Daemon
procrun (1.0.5.0 32-bit) started
[2011-06-23 09:57:52] [info] ( :0 ) Running
'Topoffice-MDS-Service-Test4' Service...
[2011-06-23 09:57:52] [debug] ( prunsrv.c:1246) Inside
ServiceMain...
[2011-06-23 09:57:52] [info] ( :0 ) Starting
service...
[2011-06-23 09:57:52] [debug] ( javajni.c:206 ) loading jvm
'C:\jdk1.6.0_24\jre\bin\client\jvm.dll'
[2011-06-23 09:57:52] [debug] ( javajni.c:660 ) Jvm Option[0]
...
...
[2011-06-23 09:57:56] [debug] ( javajni.c:844 ) argv[0] = start
[2011-06-23 09:57:56] [debug] ( javajni.c:891 ) Java Worker
thread started Foo:service
[2011-06-23 09:57:56] [debug] ( javajni.c:907 ) Java Worker
thread finished Foo:service with status=0
[2011-06-23 09:57:57] [debug] ( prunsrv.c:1058) Java started Foo
[2011-06-23 09:57:57] [info] ( :0 ) Service started
in 5198 ms.
[2011-06-23 09:57:57] [debug] ( prunsrv.c:1369) Waiting for
worker to finish...
[2011-06-23 09:57:57] [debug] ( prunsrv.c:1374) Worker finished.
[2011-06-23 09:57:57] [debug] ( prunsrv.c:1397) Waiting for all
threads to exit
Running the Win32 version of prunsrv.exe on an AMD64 Windows machine:
* Is this one of the intended usages of prunsrv.exe?
* Is the idea that on an AMD64 Windows machine, to run Foo on a
32bit JVM I use the Win32 version of prunsrv.exe, whereas to run Foo on
a 64bit JVM I use amd64\prunsrv.exe?
Thanks.
Regards,
Philip Schwarz