3

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

  • What should happen: The file gets 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(HTTPHC4Impl.java:1067) at org.apache.jmeter.protocol.http.sampler.HTTPHC4Impl.sample(HTTPHC4Impl.java:274) at org.apache.jmeter.protocol.http.sampler.HTTPSamplerProxy.sample(HTTPSamplerProxy.java:62) at org.apache.jmeter.protocol.http.sampler.HTTPSamplerBase.sample(HTTPSamplerBase.java:1054) at org.apache.jmeter.protocol.http.sampler.HTTPSamplerBase.sample(HTTPSamplerBase.java:1043) at org.apache.jmeter.threads.JMeterThread.process_sampler(JMeterThread.java:416) at org.apache.jmeter.threads.JMeterThread.run(JMeterThread.java:271) at java.lang.Thread.run(Unknown Source)

This seems to indicate that JMeter has a problem with filling out the body of a request. I can get rid of this error by specifying a parameter with the request, but I want the entire body to be the photo data. Here's the CURL line of what I want accomplished:

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

I've tried setting the content-encoding to UTF-8 as I've seen in one post, but that changed nothing.

I'm running Java 1.7.0 on Windows 7 x64. Nothing of interest gets generated in jmeter.log, and wireshark tells me that JMeter isn't sending the request.

Any ideas? Thanks in advance.

Aliaksandr Belik
  • 12,725
  • 6
  • 64
  • 90
Joe
  • 4,585
  • 3
  • 37
  • 51
  • Just adding an update. I checked out the source code and it looks like there might be a bug in 2.6. I'm confirming through the mailing list now. – Joe Mar 13 '12 at 08:11
  • Filed a bug report here: https://issues.apache.org/bugzilla/show_bug.cgi?id=52897 – Joe Mar 13 '12 at 14:45

3 Answers3

1

Turns out it was a bug that the nice folks at JMeter were able to fix very quickly: https://issues.apache.org/bugzilla/show_bug.cgi?id=52897

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

Joe
  • 4,585
  • 3
  • 37
  • 51
0

I was having issues with image uploads and found the answers here https://stackoverflow.com/a/2115944/455363. After making the suggested changes here I had to re-record the transaction and make my edits and I was successfully able to upload files.

Hope this helps.

Community
  • 1
  • 1
bkone
  • 251
  • 1
  • 5
  • 15
0

Use Raw HTTP Request to accomplish this. You may specify headers in Request Data and also specify file containing PUT body for convinience.

Some details may be found here

Andrey Pokhilko
  • 2,578
  • 18
  • 19