最近在搞并发测试,之前都没了解过这个工具,然后看着教程一看就会,一学就废,各种问题😣,希望能帮到一样无法解决该问题的你!

解决方法

直接说结论吧:就是你换个jmeter版本就ok了,对,就这么简单,我目前用的是5.1.1版本

点我下载jmeter历史版本

过程

环境

系统:window10

jmeter版本:5.4.1

JDK:16.0.1

以上环境都是目前最新的,从官网最后一版下载的(2021.6.1)

当打开jmeter时,新建线程组或者新建用例时,点击运行或者保存都会报以下错误:

You should save your test plan before running it.
If you are using supporting data files (ie, for CSV Data Set or_ _StringFromFile),
then it is particularly important to first save your test script.
Do you want to save your test plan first?

翻译:总体就是说你这个很重要,问你要不要保存。。

这不废话吗,你倒是让我保存一下,然后他就给我报错。。。

当我点yes后,感觉是保存了,但其实没有,查看了日志,看到了一堆的错误:

ERROR o.a.j.JMeter: Uncaught exception:
java.lang.NoClassDefFoundError: Could not initialize class org.apache.jmeter.gui.util.FileDialoger
at org.apache.jmeter.gui.action.Load.doActionAfterCheck(Load.java:76) ~[ApacheJMeter_core.jar:5.1.1 r1855137]
at org.apache.jmeter.gui.action.AbstractActionWithNoRunningTest.doAction(AbstractActionWithNoRunningTest.java:45) ~[ApacheJMeter_core.jar:5.1.1 r1855137]
at org.apache.jmeter.gui.action.ActionRouter.performAction(ActionRouter.java:88) ~[ApacheJMeter_core.jar:5.1.1 r1855137]
at org.apache.jmeter.gui.action.ActionRouter.lambda$actionPerformed$0(ActionRouter.java:70) ~[ApacheJMeter_core.jar:5.1.1 r1855137]
at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:313) ~[?:?]
at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:770) ~[?:?]
at java.awt.EventQueue$4.run(EventQueue.java:721) ~[?:?]
at java.awt.EventQueue4. r u n ( E v e n t Q u e u e . j a v a : 715 )   [ ? : ? ] a t j a v a . s e c u r i t y . A c c e s s C o n t r o l l e r . d o P r i v i l e g e d ( A c c e s s C o n t r o l l e r . j a v a : 389 )   [ ? : ? ] a t j a v a . s e c u r i t y . P r o t e c t i o n D o m a i n 4.run(EventQueue.java:715) ~[?:?] at java.security.AccessController.doPrivileged(AccessController.java:389) ~[?:?] at java.security.ProtectionDomain4.run(EventQueue.java:715) [?:?]atjava.security.AccessController.doPrivileged(AccessController.java:389) [?:?]atjava.security.ProtectionDomainJavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:85) ~[?:?]
at java.awt.EventQueue.dispatchEvent(EventQueue.java:740) ~[?:?]
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:203) [?:?]
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:124) [?:?]
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:113) [?:?]
.......
.....
...
...

大概类似这样,网上其他人是说缺少包,跟着下载了,并重启还是没用,后面想着可能版本问题,换了稳定一点的版本5.1.1后就行了,不知道是不是jdk的版本跟jmeter不一致导致的。

jmeter 保存 request body_程序人生