项目中使用了sigar来监测cpu的使用情况,在项目启动时,报错如下
PS C:\Users\sebin.vincent> e:
PS E:\> .\Softwares\ServerAgent-2.2.3\startAgent.bat
INFO 2019-12-30 12:17:45.122 [kg.apc.p] (): Binding UDP to 4444
INFO 2019-12-30 12:17:45.155 [kg.apc.p] (): Binding TCP to 4444
INFO 2019-12-30 12:17:45.157 [kg.apc.p] (): JP@GC Agent v2.2.3 started
INFO 2019-12-30 12:18:59.180 [kg.apc.p] (): Accepting new TCP connection
INFO 2019-12-30 12:18:59.184 [kg.apc.p] (): Yep, we received the 'test' command
INFO 2019-12-30 12:18:59.187 [kg.apc.p] (): Starting measures: memory: cpu:
#
# A fatal error has been detected by the Java Runtime Environment:
#
# EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x0000000010014ed4, pid=19028, tid=3160
#
# JRE version: Java(TM) SE Runtime Environment (11.0.4+10) (build 11.0.4+10-LTS)
# Java VM: Java HotSpot(TM) 64-Bit Server VM (11.0.4+10-LTS, mixed mode, tiered, compressed oops, g1 gc, windows-amd64)
# Problematic frame:
# C [sigar-amd64-winnt.dll+0x14ed4]
#
# No core dump will be written. Minidumps are not enabled by default on client versions of Windows
#
# An error report file with more information is saved as:
# E:\\hs_err_pid19028.log
#
# If you would like to submit a bug report, please visit:
# http://bugreport.java.com/bugreport/crash.jsp
# The crash happened outside the Java Virtual Machine in native code.
# See problematic frame for where to report the bug.
#
去具体报错文件查看并百度后,很多回答为:
sigar-amd64-winnt.dll
sigar-x86-winnt.dll
sigar-x86-winnt.lib
将三个文件放入 jdk/bin目录下,但是尝试后依然报错。
dll文件获取地址:https://gitee.com/wanghouhou/wgcloud/raw/master/sigarLibs.zip
后续再次排查发现为jdk版本问题,较高版本的jdk如1.8_251+和sigar-amd64-winnt.dll不匹配,将jdk版本降低至1.8_241后启动成功。
参考:
jdk历史版本下载链接:https://www.oracle.com/java/technologies/oracle-java-archive-downloads.html