You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@commons.apache.org by Sebastian Götz <s....@inform-technology.de> on 2021/04/16 06:35:45 UTC

[daemon] Java9 --add-modules

Hello,

I am trying to run my service with procrun as usual. After migration to 
JDK11 I found out, that a connection with jconsole (JMX) is no longer 
possible although the arguments for the JVM are the same as before. 
After some investigation I found out, I have to explicitly load the 
module jdk.management.agent. So I am trying to somewhere get the 
--add-modules jdk.management.agent part into the service config. But I 
have had no success so far. Adding it to the standard JvmOptions pane 
fails with:

[2021-04-16 08:14:49] [debug] ( prunsrv.c:1892) [ 5504] Apache Commons 
Daemon procrun log initialized.
[2021-04-16 08:14:49] [info]  ( prunsrv.c:1896) [ 5504] Apache Commons 
Daemon procrun (1.2.4.0 64-bit) started.
[2021-04-16 08:14:49] [info]  ( prunsrv.c:1806) [ 5504] Running Service 
'MY_SERVICE'...
[2021-04-16 08:14:49] [debug] ( prunsrv.c:1577) [  164] Inside 
ServiceMain...
[2021-04-16 08:14:49] [debug] ( prunsrv.c:1032) [  164] 
reportServiceStatusE: dwCurrentState = 2, dwWin32ExitCode = 0, 
dwWaitHint = 3000, dwServiceSpecificExitCode = 0.
[2021-04-16 08:14:49] [info]  ( prunsrv.c:1325) [  164] Starting service...
[2021-04-16 08:14:49] [debug] ( prunsrv.c:496 ) [  164] Checking Java 
options for environment variable requirements
[2021-04-16 08:14:49] [debug] ( prunsrv.c:500 ) [  164] Checking 
'--add-modules jdk.management.agent' for environment variable requirements
[2021-04-16 08:14:49] [debug] ( prunsrv.c:500 ) [  164] Checking 
'-XX:+UseG1GC' for environment variable requirements
[2021-04-16 08:14:49] [debug] ( prunsrv.c:500 ) [  164] Checking 
'-Dcom.sun.management.jmxremote.port=9011' for environment variable 
requirements
[2021-04-16 08:14:49] [debug] ( prunsrv.c:500 ) [  164] Checking 
'-Dcom.sun.management.jmxremote.host=localhost' for environment variable 
requirements
[2021-04-16 08:14:49] [debug] ( prunsrv.c:500 ) [  164] Checking 
'-Dcom.sun.management.jmxremote.authenticate=false' for environment 
variable requirements
[2021-04-16 08:14:49] [debug] ( prunsrv.c:500 ) [  164] Checking 
'-Dcom.sun.management.jmxremote.ssl=false' for environment variable 
requirements
[2021-04-16 08:14:49] [debug] ( prunsrv.c:500 ) [  164] Checking 
'-Deu.inform.configDir=C:\.mycomp\myapp\config' for environment variable 
requirements
[2021-04-16 08:14:49] [debug] ( javajni.c:216 ) [  164] Explicit 
RuntimeLib specified 'C:\Program 
Files\mycomp\mypath\..\java\bin\server\jvm.dll'
[2021-04-16 08:14:49] [debug] ( javajni.c:280 ) [  164] Adding Java bin 
path to the PATH to fix loading of awt.dll: 'C:\Program 
Files\mycomp\mypath\..\java\bin'
[2021-04-16 08:14:49] [debug] ( javajni.c:286 ) [  164] Loading JVM DLL 
'C:\Program Files\mycomp\mypath\..\java\bin\server\jvm.dll'
[2021-04-16 08:14:49] [debug] ( javajni.c:414 ) [  164] Loaded JVM DLL 
'C:\Program Files\mycomp\mypath\..\java\bin\server\jvm.dll', home ''.
[2021-04-16 08:14:49] [debug] ( javajni.c:419 ) [  164] 
JNI_GetCreatedJavaVMs...
[2021-04-16 08:14:49] [debug] ( javajni.c:817 ) [  328] Jvm Option[0] 
--add-modules jdk.management.agent
[2021-04-16 08:14:49] [debug] ( javajni.c:817 ) [  328] Jvm Option[1] 
-XX:+UseG1GC
[2021-04-16 08:14:49] [debug] ( javajni.c:817 ) [  328] Jvm Option[2] 
-Dcom.sun.management.jmxremote.port=9011
[2021-04-16 08:14:49] [debug] ( javajni.c:817 ) [  328] Jvm Option[3] 
-Dcom.sun.management.jmxremote.host=localhost
[2021-04-16 08:14:49] [debug] ( javajni.c:817 ) [  328] Jvm Option[4] 
-Dcom.sun.management.jmxremote.authenticate=false
[2021-04-16 08:14:49] [debug] ( javajni.c:817 ) [  328] Jvm Option[5] 
-Dcom.sun.management.jmxremote.ssl=false
[2021-04-16 08:14:49] [debug] ( javajni.c:817 ) [  328] Jvm Option[6] 
-Deu.inform.configDir=C:\.mycomp\myapp\config
[2021-04-16 08:14:49] [debug] ( javajni.c:817 ) [  328] Jvm Option[7] 
-Djava.class.path=myapp.jar
[2021-04-16 08:14:49] [debug] ( javajni.c:817 ) [  328] Jvm Option[8] exit
[2021-04-16 08:14:49] [debug] ( javajni.c:817 ) [  328] Jvm Option[9] abort
[2021-04-16 08:14:49] [debug] ( javajni.c:817 ) [  328] Jvm Option[10] 
-Xms128m
[2021-04-16 08:14:49] [debug] ( javajni.c:817 ) [  328] Jvm Option[11] 
-Xmx819m
[2021-04-16 08:14:49] [error] ( javajni.c:828 ) [  328] CreateJavaVM 
Failed with error [-1]
[2021-04-16 08:14:49] [error] ( javajni.c:828 ) [  328] The system 
cannot find the file specified.
[2021-04-16 08:14:49] [debug] ( javajni.c:1087) [  328] Java worker 
thread finished : with status = 2
[2021-04-16 08:14:49] [error] ( prunsrv.c:1386) [  164] Failed to start Java
[2021-04-16 08:14:49] [error] ( prunsrv.c:1740) [  164] ServiceStart 
returned 4.
[2021-04-16 08:14:49] [debug] ( prunsrv.c:1032) [  164] 
reportServiceStatusE: dwCurrentState = 1, dwWin32ExitCode = 1066, 
dwWaitHint = 0, dwServiceSpecificExitCode = 4.


Is this at all possible or do I have a fundamental misunderstanding of 
the issue?

Kind regards
Sebastian Götz



Re: [daemon] Java9 --add-modules

Posted by Sebastian Götz <s....@inform-technology.de>.
Okay I will try answering my own question:

It turned out, that with my configuration (Windows Server 2019 and Adopt 
OpenJDK 11) I needed to specify an additional argument to make the 
localhost JMX connection work.
This is the complete list of arguments used for the JMX server:

-Dcom.sun.management.jmxremote.port=9011
-Dcom.sun.management.jmxremote.host=localhost
-Dcom.sun.management.jmxremote.authenticate=false
-Dcom.sun.management.jmxremote.ssl=false
-Djava.rmi.server.hostname=localhost

With the additional last parameter it worked as before. So this has 
nothing to do with the initial question.

Btw: --add-modules is used in jlink to create a custom image so I was 
complete out of scope with that.

Kind regards

Am 16.04.2021 um 08:35 schrieb Sebastian Götz:
> Hello,
>
> I am trying to run my service with procrun as usual. After migration 
> to JDK11 I found out, that a connection with jconsole (JMX) is no 
> longer possible although the arguments for the JVM are the same as 
> before. After some investigation I found out, I have to explicitly 
> load the module jdk.management.agent. So I am trying to somewhere get 
> the --add-modules jdk.management.agent part into the service config. 
> But I have had no success so far. Adding it to the standard JvmOptions 
> pane fails with:
>
> [2021-04-16 08:14:49] [debug] ( prunsrv.c:1892) [ 5504] Apache Commons 
> Daemon procrun log initialized.
> [2021-04-16 08:14:49] [info]  ( prunsrv.c:1896) [ 5504] Apache Commons 
> Daemon procrun (1.2.4.0 64-bit) started.
> [2021-04-16 08:14:49] [info]  ( prunsrv.c:1806) [ 5504] Running 
> Service 'MY_SERVICE'...
> [2021-04-16 08:14:49] [debug] ( prunsrv.c:1577) [  164] Inside 
> ServiceMain...
> [2021-04-16 08:14:49] [debug] ( prunsrv.c:1032) [  164] 
> reportServiceStatusE: dwCurrentState = 2, dwWin32ExitCode = 0, 
> dwWaitHint = 3000, dwServiceSpecificExitCode = 0.
> [2021-04-16 08:14:49] [info]  ( prunsrv.c:1325) [  164] Starting 
> service...
> [2021-04-16 08:14:49] [debug] ( prunsrv.c:496 ) [  164] Checking Java 
> options for environment variable requirements
> [2021-04-16 08:14:49] [debug] ( prunsrv.c:500 ) [  164] Checking 
> '--add-modules jdk.management.agent' for environment variable requirements
> [2021-04-16 08:14:49] [debug] ( prunsrv.c:500 ) [  164] Checking 
> '-XX:+UseG1GC' for environment variable requirements
> [2021-04-16 08:14:49] [debug] ( prunsrv.c:500 ) [  164] Checking 
> '-Dcom.sun.management.jmxremote.port=9011' for environment variable 
> requirements
> [2021-04-16 08:14:49] [debug] ( prunsrv.c:500 ) [  164] Checking 
> '-Dcom.sun.management.jmxremote.host=localhost' for environment 
> variable requirements
> [2021-04-16 08:14:49] [debug] ( prunsrv.c:500 ) [  164] Checking 
> '-Dcom.sun.management.jmxremote.authenticate=false' for environment 
> variable requirements
> [2021-04-16 08:14:49] [debug] ( prunsrv.c:500 ) [  164] Checking 
> '-Dcom.sun.management.jmxremote.ssl=false' for environment variable 
> requirements
> [2021-04-16 08:14:49] [debug] ( prunsrv.c:500 ) [  164] Checking 
> '-Deu.inform.configDir=C:\.mycomp\myapp\config' for environment 
> variable requirements
> [2021-04-16 08:14:49] [debug] ( javajni.c:216 ) [  164] Explicit 
> RuntimeLib specified 'C:\Program 
> Files\mycomp\mypath\..\java\bin\server\jvm.dll'
> [2021-04-16 08:14:49] [debug] ( javajni.c:280 ) [  164] Adding Java 
> bin path to the PATH to fix loading of awt.dll: 'C:\Program 
> Files\mycomp\mypath\..\java\bin'
> [2021-04-16 08:14:49] [debug] ( javajni.c:286 ) [  164] Loading JVM 
> DLL 'C:\Program Files\mycomp\mypath\..\java\bin\server\jvm.dll'
> [2021-04-16 08:14:49] [debug] ( javajni.c:414 ) [  164] Loaded JVM DLL 
> 'C:\Program Files\mycomp\mypath\..\java\bin\server\jvm.dll', home ''.
> [2021-04-16 08:14:49] [debug] ( javajni.c:419 ) [  164] 
> JNI_GetCreatedJavaVMs...
> [2021-04-16 08:14:49] [debug] ( javajni.c:817 ) [  328] Jvm Option[0] 
> --add-modules jdk.management.agent
> [2021-04-16 08:14:49] [debug] ( javajni.c:817 ) [  328] Jvm Option[1] 
> -XX:+UseG1GC
> [2021-04-16 08:14:49] [debug] ( javajni.c:817 ) [  328] Jvm Option[2] 
> -Dcom.sun.management.jmxremote.port=9011
> [2021-04-16 08:14:49] [debug] ( javajni.c:817 ) [  328] Jvm Option[3] 
> -Dcom.sun.management.jmxremote.host=localhost
> [2021-04-16 08:14:49] [debug] ( javajni.c:817 ) [  328] Jvm Option[4] 
> -Dcom.sun.management.jmxremote.authenticate=false
> [2021-04-16 08:14:49] [debug] ( javajni.c:817 ) [  328] Jvm Option[5] 
> -Dcom.sun.management.jmxremote.ssl=false
> [2021-04-16 08:14:49] [debug] ( javajni.c:817 ) [  328] Jvm Option[6] 
> -Deu.inform.configDir=C:\.mycomp\myapp\config
> [2021-04-16 08:14:49] [debug] ( javajni.c:817 ) [  328] Jvm Option[7] 
> -Djava.class.path=myapp.jar
> [2021-04-16 08:14:49] [debug] ( javajni.c:817 ) [  328] Jvm Option[8] exit
> [2021-04-16 08:14:49] [debug] ( javajni.c:817 ) [  328] Jvm Option[9] 
> abort
> [2021-04-16 08:14:49] [debug] ( javajni.c:817 ) [  328] Jvm Option[10] 
> -Xms128m
> [2021-04-16 08:14:49] [debug] ( javajni.c:817 ) [  328] Jvm Option[11] 
> -Xmx819m
> [2021-04-16 08:14:49] [error] ( javajni.c:828 ) [  328] CreateJavaVM 
> Failed with error [-1]
> [2021-04-16 08:14:49] [error] ( javajni.c:828 ) [  328] The system 
> cannot find the file specified.
> [2021-04-16 08:14:49] [debug] ( javajni.c:1087) [  328] Java worker 
> thread finished : with status = 2
> [2021-04-16 08:14:49] [error] ( prunsrv.c:1386) [  164] Failed to 
> start Java
> [2021-04-16 08:14:49] [error] ( prunsrv.c:1740) [  164] ServiceStart 
> returned 4.
> [2021-04-16 08:14:49] [debug] ( prunsrv.c:1032) [  164] 
> reportServiceStatusE: dwCurrentState = 1, dwWin32ExitCode = 1066, 
> dwWaitHint = 0, dwServiceSpecificExitCode = 4.
>
>
> Is this at all possible or do I have a fundamental misunderstanding of 
> the issue?
>
> Kind regards
> Sebastian Götz
>
>


Mit freundlichen Grüßen
iNFORM Technology GmbH

Sebastian Götz

*****************************************************

iNFORM Technology GmbH
Berliner Straße 24
72458 Albstadt-Ebingen

Tel: +49 7431 9816090
s.goetz@inform-technology.de <ma...@inform-technology.de>
http://www.inform-technology.de/ <http://www.inform-technology.de/>

*****************************************************

iNFORM Technology GmbH
Bodenseeallee 18
D-78333 Stockach
Tel: +49 7771 91896-60

*****************************************************

<https://www.facebook.com/informTechnologyGmbH/>

Geschäftsführer: Dipl.-Ing. (FH) Heinz Roth | Handelsregister: HRB 
773712, Amtsgericht Stuttgart | USt-ID Nr.: DE312290945

Diese E-Mail enthält vertrauliche und/oder rechtlich geschützte 
Informationen. Wenn Sie nicht der richtige Adressat sind oder diese 
E-Mail irrtümlich erhalten haben, informieren Sie bitte sofort den 
Absender und vernichten Sie diese Mail. Das unerlaubte Kopieren sowie 
die unbefugte Weitergabe dieser Mail ist nicht gestattet.

This e-mail may contain confidential and/or privileged information. If 
you are not the intended recipient (or have received this e-mail in 
error) please notify the sender immediately and destroy this e-mail. Any 
unauthorised copying, disclosure or distribution of the material in this 
e-mail is strictly forbidden.