封神之作,解决Jmeter 的serverAgent 压测时报错
Java frames: (J=compiled Java code, j=interpreted, Vv=VM code) j org.hyperic.sigar.Mem.gather(Lorg/hyperic/sigar/Sigar;)V+0 j org.hyperic.sigar.Mem.fetch(Lorg/hyperic/sigar/Sigar;)Lorg/hyperic/sigar/Mem;+10 j org.hyperic.sigar.Sigar.getMem()Lorg/hyperic/sigar/Mem;+1 v ~StubRoutines::call_stub j sun.reflect.NativeMethodAccessorImpl.invoke0(Ljava/lang/reflect/Method;Ljava/lang/Object;[Ljava/lang/Object;)Ljava/lang/Object;+0 j sun.reflect.NativeMethodAccessorImpl.invoke(Ljava/lang/Object;[Ljava/lang/Object;)Ljava/lang/Object;+100 j sun.reflect.DelegatingMethodAccessorImpl.invoke(Ljava/lang/Object;[Ljava/lang/Object;)Ljava/lang/Object;+6 j java.lang.reflect.Method.invoke(Ljava/lang/Object;[Ljava/lang/Object;)Ljava/lang/Object;+56 j org.hyperic.sigar.SigarProxyCache.invoke(Ljava/lang/Object;Ljava/lang/reflect/Method;[Ljava/lang/Object;)Ljava/lang/Object;+363 j com.sun.proxy.$Proxy0.getMem()Lorg/hyperic/sigar/Mem;+9 j kg.apc.perfmon.metrics.MemTotalMetric.getValue(Ljava/lang/StringBuffer;)V+4 j kg.apc.perfmon.PerfMonMetricGetter.getMetricsLine()Ljava/nio/ByteBuffer;+51 J 287 C1 kg.apc.perfmon.PerfMonWorker.processSenders()V (197 bytes) @ 0x0000022b6a35a54c [0x0000022b6a3597c0+0xd8c] j kg.apc.perfmon.PerfMonWorker.run()V+8 j java.lang.Thread.run()V+11 v ~StubRoutines::call_stub
错误原因:JDK版本与SeverAgent需要的不匹配,我的Jmeter 3.1 版本比较低,现在JDK版本为 java version "1.8.0_261";换成"1.8.0_161"就正常了
解决方法:更改JDK版本;
方法1:卸掉原先JDK,换成低版本JDK 比如 java version "1.8.0_161"
方法2:可以自己创建包含其自己的JRE的代理程序包,这样就不必在服务器上安装java(我们在Windows平台上对其进行了测试)。为此,只需在代理文件夹中创建一个JRE文件夹,然后在其中复制一个已安装的JRE。将.bat文件中的java命令更改为java可执行文件的路径,它将起作用。)
修改startAgent.bat
@echo off cd C:\soft\ServerAgent_2.2.1\JRE\bin java -jar %0\..\CMDRunner.jar --tool PerfMonAgent %*
参考博客:https://www.jianshu.com/p/da7d7f707c5e
https://blog.csdn.net/chun521/article/details/84920237