ngrinder-agent部署到目标机器后,通过sh run_agent.sh
启动。
通过ngrinder-controller界面启动测试脚本,查看agent终端,发现运行测试出现一下错误:
Exception in thread "main" java.lang.NoClassDefFoundError: Could not initialize class java.net.InetAddress
at ch.qos.logback.core.util.ContextUtil.getLocalHostName(ContextUtil.java:32)
at ch.qos.logback.core.util.ContextUtil.addHostNameAsProperty(ContextUtil.java:41)
at ch.qos.logback.classic.joran.action.ConfigurationAction.begin(ConfigurationAction.java:48)
at ch.qos.logback.core.joran.spi.Interpreter.callBeginAction(Interpreter.java:276)
at ch.qos.logback.core.joran.spi.Interpreter.startElement(Interpreter.java:148)
at ch.qos.logback.core.joran.spi.Interpreter.startElement(Interpreter.java:130)
at ch.qos.logback.core.joran.spi.EventPlayer.play(EventPlayer.java:50)
at ch.qos.logback.core.joran.GenericConfigurator.doConfigure(GenericConfigurator.java:147)
at ch.qos.logback.core.joran.GenericConfigurator.doConfigure(GenericConfigurator.java:133)
at ch.qos.logback.core.joran.GenericConfigurator.doConfigure(GenericConfigurator.java:96)
at ch.qos.logback.core.joran.GenericConfigurator.doConfigure(GenericConfigurator.java:55)
at net.grinder.engine.process.GrinderProcess.configureLogging(GrinderProcess.java:257)
at net.grinder.engine.process.GrinderProcess.<init>(GrinderProcess.java:141)
at net.grinder.engine.process.WorkerProcessEntryPoint.run(WorkerProcessEntryPoint.java:78)
at net.grinder.engine.process.WorkerProcessEntryPoint.main(WorkerProcessEntryPoint.java:60)
解决方法:
在/etc/resolv.conf
配置文件中,添加nameserver
。
nameserver 192.168.3.1
或为网卡添加DNS配置,重启网络:
systemctl restart network
再次执行run_agent.sh
脚本启动测试代理后,可正常运行性能测试脚本。