简体   繁体   中英

Using JMX Exporter as javaagent for a sample java application

I am trying to get the JVM metrics of an existing java application, by using the JMX exporter as an agent. While trying to get the application up i am getting the below error. Any help will be greatly appreciated.

config.yaml

startDelaySeconds: 0
ssl: false
lowercaseOutputName: true
lowercaseOutputLabelNames: true
rules:
  -pattern: ".*"

java -javaagent:./jmx_prometheus_javaagent-0.17.0.jar=13579:./config.yaml -jar sample-app.jar Error:


Exception in thread "main" java.lang.reflect.InvocationTargetException at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.base/java.lang.reflect.Method.invoke(Method.java:566) at java.instrument/sun.instrument.InstrumentationImpl.loadClassAndStartAgent(InstrumentationImpl.java:513) at java.instrument/sun.instrument.InstrumentationImpl.loadClassAndCallPremain(InstrumentationImpl.java:525) Ca used by: java.lang.ClassCastException: class java.util.LinkedHashMap cannot be cast to class java.util.List (java.util.LinkedHashMap and java.util.List are in module java.base of loader 'bootstrap') at io.prometheus.jmx.JmxCollector.loadConfig(JmxCollector.java:211) at io.prometheus.jmx.JmxCollector.(JmxCollector.java:91) at io.prometheus.jmx.JavaAgent.premain(JavaAgent.java:29)... 6 more *** java.lang.instrument ASSERTION FAILED ***: "result" with message agent load/premain call failed at./src/java.instrument/share/native/libinstrument/JPLISAgent.Z4A8A08F09D37B73795649 038408B5F33Z line: 422 FATAL ERROR in native method: processing of -javaagent failed, processJavaStart failed

You're missing a space after the - in your config. It should be - pattern: ".*" , not -pattern: ".*" .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM