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.

2
  • 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. Commented Mar 13, 2012 at 8:11
  • Filed a bug report here: issues.apache.org/bugzilla/show_bug.cgi?id=52897 Commented Mar 13, 2012 at 14:45

3 Answers 3

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.

Sign up to request clarification or add additional context in comments.

Comments

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

Comments

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.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.