jMeter java.lang.IllegalArgumentException: File ex

2019-08-02 02:42发布

问题:

I updated jMeter 2.9 to 3.2 and having issues with old test cases. When I open .jmx file with jMeter 2.9 all tests runs smoothly, but when using version 3.2 from same location I get a message: The file jmeter-results.xml already exists, what do you want to do? Append to existing file - Don't start - Overwrite existing file. Doesn't matter what I choose, it doesn't work.

Log file:

2017-07-28 11:55:20,458 INFO o.a.j.e.StandardJMeterEngine: Running the test!
2017-07-28 11:55:20,458 INFO o.a.j.s.SampleEvent: List of sample_variables: 
[]
2017-07-28 11:55:20,474 INFO o.a.j.g.u.JMeterMenuBar: setRunning(true, 
*local*)
2017-07-28 11:55:20,567 INFO o.a.j.e.StandardJMeterEngine: Starting 
ThreadGroup: 1 : JMeter Users
2017-07-28 11:55:20,567 INFO o.a.j.e.StandardJMeterEngine: Starting 1 
threads for group JMeter Users.
2017-07-28 11:55:20,567 INFO o.a.j.e.StandardJMeterEngine: Thread will 
continue on error
2017-07-28 11:55:20,567 INFO o.a.j.t.ThreadGroup: Starting thread group... 
number=1 threads=1 ramp-up=5 perThread=5000.0 delayedStart=false
2017-07-28 11:55:20,567 INFO o.a.j.t.ThreadGroup: Started thread group 
number 1
2017-07-28 11:55:20,567 INFO o.a.j.e.StandardJMeterEngine: All thread groups 
have been started
2017-07-28 11:55:20,583 INFO o.a.j.t.JMeterThread: Thread started: JMeter 
Users 1-1
2017-07-28 11:55:20,583 INFO o.a.j.s.FileServer: Stored: testdata/test.csv
2017-07-28 11:55:20,583 ERROR o.a.j.t.JMeterThread: Test failed!
java.lang.IllegalArgumentException: File test.csv must exist and be readable
at org.apache.jmeter.services.FileServer.createBufferedReader(FileServer.java:430) ~[ApacheJMeter_core.jar:3.2 r1790748]
at org.apache.jmeter.services.FileServer.getReader(FileServer.java:396) ~[ApacheJMeter_core.jar:3.2 r1790748]
at org.apache.jmeter.services.FileServer.getParsedLine(FileServer.java:378) ~[ApacheJMeter_core.jar:3.2 r1790748]
at org.apache.jmeter.config.CSVDataSet.iterationStart(CSVDataSet.java:200) ~[ApacheJMeter_components.jar:3.2 r1790748]
at org.apache.jmeter.control.GenericController.fireIterationStart(GenericController.java:393) ~[ApacheJMeter_core.jar:3.2 r1790748]
at org.apache.jmeter.control.GenericController.fireIterEvents(GenericController.java:385) ~[ApacheJMeter_core.jar:3.2 r1790748]
at org.apache.jmeter.control.GenericController.next(GenericController.java:158) ~[ApacheJMeter_core.jar:3.2 r1790748]
at org.apache.jmeter.control.LoopController.next(LoopController.java:123) ~[ApacheJMeter_core.jar:3.2 r1790748]
at org.apache.jmeter.threads.AbstractThreadGroup.next(AbstractThreadGroup.java:87) ~[ApacheJMeter_core.jar:3.2 r1790748]
at org.apache.jmeter.threads.JMeterThread.run(JMeterThread.java:252) [ApacheJMeter_core.jar:3.2 r1790748]
at java.lang.Thread.run(Unknown Source) [?:1.8.0_141]
2017-07-28 11:55:20,583 INFO o.a.j.t.JMeterThread: Thread finished: JMeter 
Users 1-1
2017-07-28 11:55:20,583 INFO o.a.j.e.StandardJMeterEngine: Notifying test 
listeners of end of test
2017-07-28 11:55:20,583 INFO o.a.j.g.u.JMeterMenuBar: setRunning(false, 
*local*)

回答1:

  1. If you are talking about this warning:

    it is enhancement introduced in JMeter 3.2 within the bounds of issue 58164. Just remove all the listeners from your Test Plan and the warning will go away. Actually you don't need to have any listeners as they create overhead and may ruin your test, consider storing your test result to .jtl result file using -l command-line argument instead.

  2. Looking into this line:

    2017-07-30 14:29:57,918 INFO o.a.j.s.FileServer: Stored: testdata/test.csv

    you simply forgot to copy your test.csv file to new JMeter installation

    • Go to the JMeter 3.2 "bin" folder
    • Create folder testdata there
    • Copy your test.csv file into the testdata folder

    Or just use the absolute path to your test.csv file.