Am 31.08.20 um 21:57 schrieb Mark Thomas:
> On 31/08/2020 12:38, JP wrote:
>> Hello,
>>
>> Can anyone tell me if prunsrv does support JPMS/modularized applications
>> on the Windows platform? I read that Jsvc does support it, but I havn't
>> found anything about prunsrv in the docs so far.
>>
>> I tried to modify my configuration, but hat no luck yet. On the command
>> line the syntax to launch the application would be:
>>
>> jre\bin\java.exe --module-path modules --module
>> de.my.package/de.my.package.Main
>>
>> Any help appreciated. Thanks.
> 
> What have you tried so far? What happened? How did that differ from what
> you expected?
> 
> Generally, procrun passes arguments like that direct to the JVM.
> 
> There might be something about jvm mode that means it needs special
> setup but I'd expect java mode to work out of the box.
> 
> Mark
> 

I tried the JVM mode with the service config (arguments as array in a
PowerShell script):

        "install",
        "MyService",
        "--DisplayName=""My Service""",
        "--JavaHome=""$RootPath\jre""",
        "--Jvm=""$RootPath\jre\bin\client\jvm.dll""",
        "--StartMode=jvm",
        "--StopMode=jvm",
        "--JvmOptions9=""--module-path modules""",
        "++JvmOptions9=""--module de.my.package/de.my.package.Main""",
    "--StartClass=de.my.package.Main",
    "--StopClass=de.my.package.Main",
        "--StopTimeout=300",
        "--JvmMs=128",
        "--JvmMx=1024",
        "--JvmSs=128",
        "--LogPath=$RootPath\log",
        "--LogPrefix=service",
        "--LogLevel=Debug",
        "--StdOutput=auto",
        "--StdError=auto",
        "--StartPath=$RootPath",
        "--Startup=auto",
        "--LogJniMessages=1"
        
The log output: 

( prunsrv.c:1763) [ 5048] Apache Commons Daemon procrun log initialized.
( prunsrv.c:1767) [ 5048] Apache Commons Daemon procrun (1.2.2.0 64-bit)
started.
( prunsrv.c:621 ) [ 5048] Installing service...
( prunsrv.c:660 ) [ 5048] Installing service 'MyService' name 'My Service'.
( prunsrv.c:694 ) [ 5048] Service 'MyService' installed.
( prunsrv.c:1848) [ 5048] Apache Commons Daemon procrun finished.
( prunsrv.c:1763) [ 7308] Apache Commons Daemon procrun log initialized.
( prunsrv.c:1767) [ 7308] Apache Commons Daemon procrun (1.2.2.0 64-bit)
started.
( prunsrv.c:1677) [ 7308] Running Service 'MyService'...
( prunsrv.c:1448) [ 4548] Inside ServiceMain...
( prunsrv.c:910 ) [ 4548] reportServiceStatusE: dwCurrentState = 2,
dwWin32ExitCode = 0, dwWaitHint = 3000, dwServiceSpecificExitCode = 0.
( prunsrv.c:1203) [ 4548] Starting service...
( javajni.c:216 ) [ 4548] Explicit RuntimeLib specified
'D:\MyService\jre\bin\client\jvm.dll'
( javajni.c:285 ) [ 4548] loading jvm 'D:\MyService\jre\bin\client\jvm.dll'
( javajni.c:795 ) [ 5688] Jvm Option[0] vfprintf
( javajni.c:795 ) [ 5688] Jvm Option[1] --module-path modules
( javajni.c:795 ) [ 5688] Jvm Option[2] --module
de.my.package/de.my.package.Main
( javajni.c:795 ) [ 5688] Jvm Option[3] exit
( javajni.c:795 ) [ 5688] Jvm Option[4] abort
( javajni.c:795 ) [ 5688] Jvm Option[5] -Xms128m
( javajni.c:795 ) [ 5688] Jvm Option[6] -Xmx1024m
( javajni.c:795 ) [ 5688] Jvm Option[7] -Xss128k
( javajni.c:536 ) [ 5688] Unrecognized option: --module-path modules
( javajni.c:806 ) [ 5688] CreateJavaVM Failed with error [-1]
( javajni.c:806 ) [ 5688] Das System kann die angegebene Datei nicht finden.
( javajni.c:1057) [ 5688] Java Worker thread finished : with status = 2
( prunsrv.c:1258) [ 4548] Failed to start Java
( prunsrv.c:1611) [ 4548] ServiceStart returned 4.
( prunsrv.c:910 ) [ 4548] reportServiceStatusE: dwCurrentState = 1,
dwWin32ExitCode = 1066, dwWaitHint = 0, dwServiceSpecificExitCode = 4.
( prunsrv.c:1679) [ 7308] Run service finished.
( prunsrv.c:1848) [ 7308] Apache Commons Daemon procrun finished.

If I change Jvm to java.exe and StartMode to Java the stderr log states:

2020-09-01 18:18:10 Apache Commons Daemon procrun stderr initialized.
NOTE: Picked up JDK_JAVA_OPTIONS: --module-path modules --module
de.my.package/de.my.package.Main

Error: Option --module is not allowed in environment variable
JDK_JAVA_OPTIONS

What am I doing wrong?

JP

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscr...@commons.apache.org
For additional commands, e-mail: user-h...@commons.apache.org

Reply via email to