今天在學習Jmeter的java request,請求內容是鏈接redis並獲取其中的一個字段值。結果在運行時報以下錯誤:java
2018/05/24 13:08:20 ERROR - jmeter.threads.JMeterThread: Test failed! java.lang.NoClassDefFoundError: redis/clients/jedis/Jedis
at cn.testfan.redis.RedisJavaTest.setupTest(RedisJavaTest.java:36)
at org.apache.jmeter.protocol.java.sampler.JavaSampler.sample(JavaSampler.java:193)
at org.apache.jmeter.threads.JMeterThread.executeSamplePackage(JMeterThread.java:475)
at org.apache.jmeter.threads.JMeterThread.processSampler(JMeterThread.java:418)
at org.apache.jmeter.threads.JMeterThread.run(JMeterThread.java:249)
at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.ClassNotFoundException: redis.clients.jedis.Jedis
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
報錯緣由:jmeter中缺乏相應jar包。redis
解決方法:在網上下載jedis-2.9.0.jar後將其放到jmeter的lib目錄下,重啓jmeter,運行成功。apache