我试图用如下命令行生成 jMeter 结果统计报表时:
jmeter -g results/2021-10-08-1216.csv -o reports/a1 -p user.properties
遇到如下错误:
2021-10-08 14:45:56,424 ERROR o.a.j.JMeter: An error occurred:
org.apache.jmeter.report.dashboard.GenerationException: Cannot assign “j m e t e r . r e p o r t g e n e r a t o r . a p d e x s a t i s f i e d t h r e s h o l d " t o p r o p e r t y " s e t s a t i s f i e d t h r e s h o l d " ( m a p p e d a s " s e t S a t i s f i e d T h r e s h o l d " ) , s k i p i t a t o r g . a p a c h e . j m e t e r . r e p o r t . d a s h b o a r d . R e p o r t G e n e r a t o r . s e t P r o p e r t y ( R e p o r t G e n e r a t o r . j a v a : 552 ) [ A p a c h e J M e t e r c o r e . j a r : 5.4.1 ] a t o r g . a p a c h e . j m e t e r . r e p o r t . d a s h b o a r d . R e p o r t G e n e r a t o r . a d d G r a p h C o n s u m e r ( R e p o r t G e n e r a t o r . j a v a : 348 ) [ A p a c h e J M e t e r c o r e . j a r : 5.4.1 ] a t o r g . a p a c h e . j m e t e r . r e p o r t . d a s h b o a r d . R e p o r t G e n e r a t o r . g e n e r a t e ( R e p o r t G e n e r a t o r . j a v a : 234 ) [ A p a c h e J M e t e r c o r e . j a r : 5.4.1 ] a t o r g . a p a c h e . j m e t e r . J M e t e r . s t a r t ( J M e t e r . j a v a : 558 ) [ A p a c h e J M e t e r c o r e . j a r : 5.4.1 ] a t j d k . i n t e r n a l . r e f l e c t . N a t i v e M e t h o d A c c e s s o r I m p l . i n v o k e 0 ( N a t i v e M e t h o d ) [ ? : ? ] a t j d k . i n t e r n a l . r e f l e c t . N a t i v e M e t h o d A c c e s s o r I m p l . i n v o k e ( N a t i v e M e t h o d A c c e s s o r I m p l . j a v a : 62 ) [ ? : ? ] a t j d k . i n t e r n a l . r e f l e c t . D e l e g a t i n g M e t h o d A c c e s s o r I m p l . i n v o k e ( D e l e g a t i n g M e t h o d A c c e s s o r I m p l . j a v a : 43 ) [ ? : ? ] a t j a v a . l a n g . r e f l e c t . M e t h o d . i n v o k e ( M e t h o d . j a v a : 566 ) [ ? : ? ] a t o r g . a p a c h e . j m e t e r . N e w D r i v e r . m a i n ( N e w D r i v e r . j a v a : 254 ) [ A p a c h e J M e t e r . j a r : 5.4.1 ] C a u s e d b y : o r g . a p a c h e . j m e t e r . r e p o r t . c o r e . C o n v e r t E x c e p t i o n : U n a b l e t o c o n v e r t " {jmeter.reportgenerator.apdex_satisfied_threshold}" to property "set_satisfied_threshold" (mapped as "setSatisfiedThreshold"), skip it at org.apache.jmeter.report.dashboard.ReportGenerator.setProperty(ReportGenerator.java:552) ~[ApacheJMeter_core.jar:5.4.1] at org.apache.jmeter.report.dashboard.ReportGenerator.addGraphConsumer(ReportGenerator.java:348) ~[ApacheJMeter_core.jar:5.4.1] at org.apache.jmeter.report.dashboard.ReportGenerator.generate(ReportGenerator.java:234) ~[ApacheJMeter_core.jar:5.4.1] at org.apache.jmeter.JMeter.start(JMeter.java:558) [ApacheJMeter_core.jar:5.4.1] at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:?] at jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:?] at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?] at java.lang.reflect.Method.invoke(Method.java:566) ~[?:?] at org.apache.jmeter.NewDriver.main(NewDriver.java:254) [ApacheJMeter.jar:5.4.1] Caused by: org.apache.jmeter.report.core.ConvertException: Unable to convert "jmeter.reportgenerator.apdex
s
atisfied
t
hreshold"toproperty"set
s
atisfied
t
hreshold"(mappedas"setSatisfiedThreshold"),skipitatorg.apache.jmeter.report.dashboard.ReportGenerator.setProperty(ReportGenerator.java:552) [ApacheJMeter
c
ore.jar:5.4.1]atorg.apache.jmeter.report.dashboard.ReportGenerator.addGraphConsumer(ReportGenerator.java:348) [ApacheJMeter
c
ore.jar:5.4.1]atorg.apache.jmeter.report.dashboard.ReportGenerator.generate(ReportGenerator.java:234) [ApacheJMeter
c
ore.jar:5.4.1]atorg.apache.jmeter.JMeter.start(JMeter.java:558)[ApacheJMeter
c
ore.jar:5.4.1]atjdk.internal.reflect.NativeMethodAccessorImpl.invoke0(NativeMethod) [?:?]atjdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) [?:?]atjdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) [?:?]atjava.lang.reflect.Method.invoke(Method.java:566) [?:?]atorg.apache.jmeter.NewDriver.main(NewDriver.java:254)[ApacheJMeter.jar:5.4.1]Causedby:org.apache.jmeter.report.core.ConvertException:Unabletoconvert"{jmeter.reportgenerator.apdex_satisfied_threshold}” to “java.lang.Long”
at org.apache.jmeter.report.core.Converters.lambda$static4 ( C o n v e r t e r s . j a v a : 79 ) [ A p a c h e J M e t e r c o r e . j a r : 5.4.1 ] a t o r g . a p a c h e . j m e t e r . r e p o r t . d a s h b o a r d . R e p o r t G e n e r a t o r . s e t P r o p e r t y ( R e p o r t G e n e r a t o r . j a v a : 539 ) [ A p a c h e J M e t e r c o r e . j a r : 5.4.1 ] . . . 8 m o r e C a u s e d b y : j a v a . l a n g . N u m b e r F o r m a t E x c e p t i o n : F o r i n p u t s t r i n g : " 4(Converters.java:79) ~[ApacheJMeter_core.jar:5.4.1] at org.apache.jmeter.report.dashboard.ReportGenerator.setProperty(ReportGenerator.java:539) ~[ApacheJMeter_core.jar:5.4.1] ... 8 more Caused by: java.lang.NumberFormatException: For input string: "4(Converters.java:79) [ApacheJMeter
c
ore.jar:5.4.1]atorg.apache.jmeter.report.dashboard.ReportGenerator.setProperty(ReportGenerator.java:539) [ApacheJMeter
c
ore.jar:5.4.1]...8moreCausedby:java.lang.NumberFormatException:Forinputstring:"{jmeter.reportgenerator.apdex_satisfied_threshold}"
at java.lang.NumberFormatException.forInputString(NumberFormatException.java:65) ~[?:?]
at java.lang.Long.parseLong(Long.java:678) ~[?:?]
at java.lang.Long.valueOf(Long.java:1144) ~[?:?]
at org.apache.jmeter.report.core.Converters.lambda$static$4(Converters.java:77) ~[ApacheJMeter_core.jar:5.4.1]
at org.apache.jmeter.report.dashboard.ReportGenerator.setProperty(ReportGenerator.java:539) ~[ApacheJMeter_core.jar:5.4.1]
… 8 more
在这个 *帖子找到了线索。
在我的场景中,我错误地从使用 -q properties file 更改为 -p properties file. 我没有意识到(当时)是 -q 定义了一个要读取的附加属性文件,而 -p 覆盖了 jmeter.properties 文件。 因此,在使用 -p 时,我缺少正确生成仪表板所需的属性。
-p 改成 -q 后,问题解决: