JMeter file upload using HTTP method doesn't work

The idea is to create a sampler in JMeter that will upload the file using the HTTP PUT method. I am trying to follow the official documentation to specify the entire content object as a file with no parameter name.

  • What should happen: the file is uploaded and the server returns 201: created
  • What actually happens:

java.lang.NullPointerException: charsetName at java.lang.String.<init>(Unknown Source) at java.lang.String.<init>(Unknown Source) at org.apache.jmeter.protocol.http.sampler.HTTPHC4Impl.sendPutData( at org.apache.jmeter.protocol.http.sampler.HTTPHC4Impl.sample( at org.apache.jmeter.protocol.http.sampler.HTTPSamplerProxy.sample( at org.apache.jmeter.protocol.http.sampler.HTTPSamplerBase.sample( at org.apache.jmeter.protocol.http.sampler.HTTPSamplerBase.sample( at org.apache.jmeter.threads.JMeterThread.process_sampler( at at Source)

This seems to indicate that JMeter is having a problem filling in the request body. I can get rid of this error by specifying a parameter with the request, but I want the whole body to be photodata. Here's the CURL line I want to execute:

curl -u testuser:testpass "http://localhost:8080/photo" -T photo.jpg -H "content-type:image/jpeg"

I tried setting the content encoding to UTF-8 as I saw in one post, but didn't change anything.

I am running Java 1.7.0 on Windows 7 x64. Nothing interesting is generated in the jmeter.log and wireshark tells me that JMeter is not sending a request.

Any ideas? Thanks in advance.


source to share

3 answers

It turns out it was a bug that the good people at JMeter were able to fix very quickly:

Using a nightly build solved my problem, and by now it has probably made it into release.



Use a Raw HTTP Request to accomplish this. You can specify headers in data requests and also specify the file containing the PUT body for convenience.

Some details can be found here



I'm having problems downloading the images and find answers here / ... . After making the suggested changes, I had to rewrite the transaction and make the changes and I was able to upload the files successfully.

Hope it helps.



All Articles