0
votes

With JMeter files can be sent successfully

Config: enter image description here

Output (success): enter image description here

But it doesn't work if changing the file name to a variable. Attended images you will find file path is set to ${logname}, which can be resolved correctly, but the content-length is incorrect.

After changing the file name to the variable, the http will response error message, saying "java.io.FileNotFoundException: ulog_5b9139cf-5542-42dc-ae76-7fde3a61c67b_235152af-feb7-4249-a168-12ed4abb426c_0.log (The system cannot find the file specified)".

I think the incorrect content-length led to server fail to read the file content. Is is right? How to fix it? Thanks.

Config: enter image description here Output (failure): The filename is resolved correctly, but content length is incorrect: enter image description hereenter image description here

1

1 Answers

1
votes

JMeter is looking for the file in it's Base Dir.

If you look into your jmeter.log file you'll see something like:

2014/03/05 15:52:37 INFO  - jmeter.services.FileServer: Default base='/home/jmeter' 
2014/03/05 15:52:37 INFO  - jmeter.services.FileServer: Set new base='/home/jmeter' 

This is where JMeter expects file to be located.

So you can either prefix your ${logname} variable with full path to your user's Desktop like

C:\Users\youruser\Desktop\${logname}

Or alternatively change location where JMeter is looking for files via Beahshell Pre Processor as follows:

import org.apache.jmeter.services.FileServer;
FileServer.getFileServer().setBaseDir("C:/Users/youruser/Desktop");

But use it with caution as it may have impact on other relative paths.