Closed xiaodunxin closed 1 year ago
根据看异常日志,可以在 JVM 启动参数中添加:--add-opens java.base/java.lang=ALL-UNNAMED
。
后续我会更新 README
好的感谢,有尝试将develop下载下来将相关jdk9后不推荐使用的方法进行替换,但是还未成功,目前加上 --add-opens java.base/java.lang=ALL-UNNAMED 可以解决问题,后续会将此工具作为B站分享的素材,感谢您的贡献。
好的感谢,有尝试将develop下载下来将相关jdk9后不推荐使用的方法进行替换,但是还未成功,目前加上 --add-opens java.base/java.lang=ALL-UNNAMED 可以解决问题,后续会将此工具作为B站分享的素材,感谢您的贡献。
客气,感谢分享和推广 MyPerf4J : )
Bug 描述
使用 jdk 8 没啥问题,用 17 程序报错
运行环境
配置文件
app_name = MyPerf4J
metrics.exporter = log.stdout
metrics.log.method = /Users/hujiao/develop/MyPerf4J-ASM-3.3.0-SNAPSHOT\metrics.log metrics.log.class_loading = /Users/hujiao/develop/MyPerf4J-ASM-3.3.0-SNAPSHOT\metrics.log metrics.log.gc = /Users/hujiao/develop/MyPerf4J-ASM-3.3.0-SNAPSHOT\metrics.log metrics.log.memory = /Users/hujiao/develop/MyPerf4J-ASM-3.3.0-SNAPSHOT\metrics.log metrics.log.buff_pool = /Users/hujiao/develop/MyPerf4J-ASM-3.3.0-SNAPSHOT\metrics.log metrics.log.thread = /Users/hujiao/develop/MyPerf4J-ASM-3.3.0-SNAPSHOT\metrics.log metrics.log.file_desc = /Users/hujiao/develop/MyPerf4J-ASM-3.3.0-SNAPSHOT\metrics.log metrics.log.compilation = /Users/hujiao/develop/MyPerf4J-ASM-3.3.0-SNAPSHOT\metrics.log
influxdb.version = 2.7.1 influxdb.orgName = influxdb influxdb.host = 127.0.0.1 influxdb.port = 8086 influxdb.database = MyPerf4J
influxdb.username = admin influxdb.password = xx
influxdb.conn_timeout = 3000 influxdb.read_timeout = 5000
filter.packages.include = com/example/demo.*;
filter.packages.exclude = cn.perf4j.demo.dao.DemoDAOImpl
metrics.time_slice.method = 10000
metrics.time_slice.jvm = 10000
metrics.method.show_params = true
异常堆栈
2023-07-29 16:33:30.019 [MyPerf4J] ERROR [MyPerf4J-LightWeightScheduler-1] JvmMetricsScheduler.processThreadMetrics(1690619600008, 1690619600008, 1690619610008) null java.lang.ExceptionInInitializerError at cn.myperf4j.core.scheduler.JvmMetricsScheduler.processThreadMetrics(JvmMetricsScheduler.java:139) at cn.myperf4j.core.scheduler.JvmMetricsScheduler.run(JvmMetricsScheduler.java:72) at cn.myperf4j.core.LightWeightScheduler.runTask(LightWeightScheduler.java:100) at cn.myperf4j.core.LightWeightScheduler.runAllTasks(LightWeightScheduler.java:93) at cn.myperf4j.core.LightWeightScheduler.access$200(LightWeightScheduler.java:18) at cn.myperf4j.core.LightWeightScheduler$1.run(LightWeightScheduler.java:85) at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:539) at java.base/java.util.concurrent.FutureTask.runAndReset(FutureTask.java:305) at java.base/java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:305) at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136) at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635) at java.base/java.lang.Thread.run(Thread.java:833) Caused by: java.lang.reflect.InaccessibleObjectException: Unable to make private static native java.lang.Thread[] java.lang.Thread.getThreads() accessible: module java.base does not "opens java.lang" to unnamed module @407c8a68 at java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:354) at java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:297) at java.base/java.lang.reflect.Method.checkCanSetAccessible(Method.java:199) at java.base/java.lang.reflect.Method.setAccessible(Method.java:193) at cn.myperf4j.base.metric.collector.JvmThreadCollector.reflectGetThreadsMethod(JvmThreadCollector.java:34) at cn.myperf4j.base.metric.collector.JvmThreadCollector.(JvmThreadCollector.java:27)
... 12 more
/***/
ava.lang.NoClassDefFoundError: Could not initialize class cn.myperf4j.base.metric.collector.JvmThreadCollector at cn.myperf4j.core.scheduler.JvmMetricsScheduler.processThreadMetrics(JvmMetricsScheduler.java:139) at cn.myperf4j.core.scheduler.JvmMetricsScheduler.run(JvmMetricsScheduler.java:72) at cn.myperf4j.core.LightWeightScheduler.runTask(LightWeightScheduler.java:100) at cn.myperf4j.core.LightWeightScheduler.runAllTasks(LightWeightScheduler.java:93) at cn.myperf4j.core.LightWeightScheduler.access$200(LightWeightScheduler.java:18) at cn.myperf4j.core.LightWeightScheduler$1.run(LightWeightScheduler.java:85) at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:539) at java.base/java.util.concurrent.FutureTask.runAndReset(FutureTask.java:305) at java.base/java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:305) at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136) at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635) at java.base/java.lang.Thread.run(Thread.java:833)