Open glego opened 2 years ago
Enable Level DEBUG and provide the contents of the tomcat service log. This might provide a clue.
@glego I just tested this and don't see any issues. Please test using absolute paths to the jmx_prometheus_javaagent-0.16.1.jar
and tomcat.yaml
.
Example:
-javaagent:C:\opt\jmx_prometheus_javaagent-0.16.1.jar=18080:C:\opt\tomcat.yaml
i have the same problem. Manual launch work but don't in service mode with the same configuration. JAVA 19.0.2 TOMCAT 9.0 AGENT 0.17.2 in setenv.bat:
set JAVA_OPTS=%JAVA_OPTS% -javaagent:"C:\jmxexporter\jmx_prometheus_javaagent-0.17.2.jar=12345:C:\jmxexporter\config.yaml"
in java options ui
-Dcatalina.home=C:\Program Files\Apache Software Foundation\Tomcat 9.0
-Dcatalina.base=C:\Program Files\Apache Software Foundation\Tomcat 9.0
-Djava.io.tmpdir=C:\Program Files\Apache Software Foundation\Tomcat 9.0\temp
-Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager
-Djava.util.logging.config.file=C:\Program Files\Apache Software Foundation\Tomcat 9.0\conf\logging.properties
-javaagent:"C:\jmxexporter\jmx_prometheus_javaagent-0.17.2.jar=12345:C:\jmxexporter\config.yaml"
commons-daemon.XXXX.XX.XX.log after starting as a service
[2023-01-27 22:21:11] [debug] ( prunsrv.c:2010:main ) [ 1896] Apache Commons Daemon procrun log initialized.
[2023-01-27 22:21:12] [info] ( prunsrv.c:2018:main ) [ 1896] Apache Commons Daemon procrun (1.3.3.0 64-bit) started.
[2023-01-27 22:21:12] [info] ( prunsrv.c:1922:docmdRunService ) [ 1896] Running Service 'Tomcat9'...
[2023-01-27 22:21:13] [debug] ( prunsrv.c:1681:serviceMain ) [ 9312] Inside serviceMain()...
[2023-01-27 22:21:13] [debug] ( prunsrv.c:1127:reportServiceStatusE ) [ 9312] reportServiceStatusE: dwCurrentState = 2 (SERVICE_START_PENDING), dwWin32ExitCode = 0, dwWaitHint = 3000 milliseconds, dwServiceSpecificExitCode = 0.
[2023-01-27 22:21:14] [info] ( prunsrv.c:1426:serviceStart ) [ 9312] Starting service...
[2023-01-27 22:21:14] [debug] ( prunsrv.c:499 :setInprocEnvironmentOptions) [ 9312] Checking Java options for environment variable requirements
[2023-01-27 22:21:14] [debug] ( prunsrv.c:503 :setInprocEnvironmentOptions) [ 9312] Checking environment variable requirements for '-Dcatalina.home=C:\Program Files\Apache Software Foundation\Tomcat 9.0'
[2023-01-27 22:21:14] [debug] ( prunsrv.c:503 :setInprocEnvironmentOptions) [ 9312] Checking environment variable requirements for '-Dcatalina.base=C:\Program Files\Apache Software Foundation\Tomcat 9.0'
[2023-01-27 22:21:14] [debug] ( prunsrv.c:503 :setInprocEnvironmentOptions) [ 9312] Checking environment variable requirements for '-Djava.io.tmpdir=C:\Program Files\Apache Software Foundation\Tomcat 9.0\temp'
[2023-01-27 22:21:14] [debug] ( prunsrv.c:503 :setInprocEnvironmentOptions) [ 9312] Checking environment variable requirements for '-Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager'
[2023-01-27 22:21:14] [debug] ( prunsrv.c:503 :setInprocEnvironmentOptions) [ 9312] Checking environment variable requirements for '-Djava.util.logging.config.file=C:\Program Files\Apache Software Foundation\Tomcat 9.0\conf\logging.properties'
[2023-01-27 22:21:14] [debug] ( prunsrv.c:503 :setInprocEnvironmentOptions) [ 9312] Checking environment variable requirements for '-javaagent:"C:\jmxexporter\jmx_prometheus_javaagent-0.17.2.jar=12345:C:\jmxexporter\config.yaml"'
[2023-01-27 22:21:15] [debug] ( javajni.c:216 :__apxLoadJvmDll ) [ 9312] Explicit RuntimeLib specified 'C:\jdk-19.0.2\bin\server\jvm.dll'
[2023-01-27 22:21:15] [debug] ( javajni.c:285 :__apxLoadJvmDll ) [ 9312] Adding Java bin path to the PATH to fix loading of awt.dll: 'C:\jdk-19.0.2\bin'
[2023-01-27 22:21:15] [debug] ( javajni.c:291 :__apxLoadJvmDll ) [ 9312] Loading JVM DLL 'C:\jdk-19.0.2\bin\server\jvm.dll'
[2023-01-27 22:21:15] [debug] ( javajni.c:419 :apxCreateJava ) [ 9312] Loaded JVM DLL 'C:\jdk-19.0.2\bin\server\jvm.dll', home '(null)'.
[2023-01-27 22:21:15] [debug] ( javajni.c:424 :apxCreateJava ) [ 9312] JNI_GetCreatedJavaVMs...
[2023-01-27 22:21:15] [debug] ( javajni.c:822 :apxJavaInitialize ) [ 9780] JVM Option[0] -Dcatalina.home=C:\Program Files\Apache Software Foundation\Tomcat 9.0
[2023-01-27 22:21:15] [debug] ( javajni.c:822 :apxJavaInitialize ) [ 9780] JVM Option[1] -Dcatalina.base=C:\Program Files\Apache Software Foundation\Tomcat 9.0
[2023-01-27 22:21:15] [debug] ( javajni.c:822 :apxJavaInitialize ) [ 9780] JVM Option[2] -Djava.io.tmpdir=C:\Program Files\Apache Software Foundation\Tomcat 9.0\temp
[2023-01-27 22:21:15] [debug] ( javajni.c:822 :apxJavaInitialize ) [ 9780] JVM Option[3] -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager
[2023-01-27 22:21:15] [debug] ( javajni.c:822 :apxJavaInitialize ) [ 9780] JVM Option[4] -Djava.util.logging.config.file=C:\Program Files\Apache Software Foundation\Tomcat 9.0\conf\logging.properties
[2023-01-27 22:21:16] [debug] ( javajni.c:822 :apxJavaInitialize ) [ 9780] JVM Option[5] -javaagent:"C:\jmxexporter\jmx_prometheus_javaagent-0.17.2.jar=12345:C:\jmxexporter\config.yaml"
[2023-01-27 22:21:16] [debug] ( javajni.c:822 :apxJavaInitialize ) [ 9780] JVM Option[6] --add-opens=java.base/java.lang=ALL-UNNAMED
[2023-01-27 22:21:16] [debug] ( javajni.c:822 :apxJavaInitialize ) [ 9780] JVM Option[7] --add-opens=java.base/java.io=ALL-UNNAMED
[2023-01-27 22:21:16] [debug] ( javajni.c:822 :apxJavaInitialize ) [ 9780] JVM Option[8] --add-opens=java.rmi/sun.rmi.transport=ALL-UNNAMED
[2023-01-27 22:21:16] [debug] ( javajni.c:822 :apxJavaInitialize ) [ 9780] JVM Option[9] -Djava.class.path=C:\Program Files\Apache Software Foundation\Tomcat 9.0\bin\bootstrap.jar;C:\Program Files\Apache Software Foundation\Tomcat 9.0\bin\tomcat-juli.jar
[2023-01-27 22:21:16] [debug] ( javajni.c:822 :apxJavaInitialize ) [ 9780] JVM Option[10] exit
[2023-01-27 22:21:16] [debug] ( javajni.c:822 :apxJavaInitialize ) [ 9780] JVM Option[11] abort
[2023-01-27 22:21:16] [debug] ( javajni.c:822 :apxJavaInitialize ) [ 9780] JVM Option[12] -Xms512m
[2023-01-27 22:21:16] [debug] ( javajni.c:822 :apxJavaInitialize ) [ 9780] JVM Option[13] -Xmx512m
[2023-01-27 22:21:16] [debug] ( javajni.c:578 :__apxJniAbort ) [ 9780] JVM aborted
[2023-01-27 22:21:17] [debug] ( prunsrv.c:1203:onExitStart ) [ 9780] Start exit hook called...
[2023-01-27 22:21:17] [debug] ( prunsrv.c:1204:onExitStart ) [ 9780] JVM exit code: 1.
Same issue here. Any solution?
I retested the scenario on Windows 2019 + JMX Exporter versions 0.16.1, 0.17.2, and 0.18.0 and don't see any issues.
When setting the Java agent properties via the Java options UI, do not use double quotes around the arguments.
Example:
-javaagent:C:\jmxexporter\jmx_prometheus_javaagent-0.17.2.jar=12345:C:\jmxexporter\config.yaml
Issue description
Unable to start tomcat service when adding jmx_prometheus_javaagent as javaagent.
Environment
tomcat8w.exe //ES//xxxx
Observations
No stderr / stdout when starting the service
Running tomcat manually works