jmeter之Java request报错:java.lang.NoClassDefFoundError: redis/clients/jedis/Jedis

Posted zhengna

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了jmeter之Java request报错:java.lang.NoClassDefFoundError: redis/clients/jedis/Jedis相关的知识,希望对你有一定的参考价值。

今天在学习Jmeter的java request,请求内容是连接redis并获取其中的一个字段值。结果在运行时报如下错误:

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包。

解决方法:在网上下载jedis-2.9.0.jar后将其放到jmeter的lib目录下,重启jmeter,运行成功。

以上是关于jmeter之Java request报错:java.lang.NoClassDefFoundError: redis/clients/jedis/Jedis的主要内容,如果未能解决你的问题,请参考以下文章

性能工具之Jmeter JDBC Request学习

Jmeter之JDBC Request (Mysql)

Jmeter常用脚本开发之Junit Request

解决jmeter执行报错之神奇的Use KeepAlive

问题解决方案之 jmeter启动报错:Not able to find Java executable or version. Please check your Java installatio(代

Jmeter性能测试之分布式