使用HTTP Put方法的JMeter文件上传不起作用 [英] JMeter File Upload with HTTP Put Method Not Working

查看:648
本文介绍了使用HTTP Put方法的JMeter文件上传不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这个想法是在JMeter中构建一个采样器,该采样器将使用HTTP PUT方法上传文件.我正在尝试遵循官方文档将整个内容主体指定为没有参数名称的文件.

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.

  • 应该发生什么:上传文件,服务器返回201:已创建
  • 实际发生的情况:

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)

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)

这似乎表明JMeter在填写请求正文方面存在问题.我可以通过在请求中指定一个参数来消除此错误,但是我希望整个主体都是照片数据.这是我要完成的操作的CURL行:

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"

我曾尝试在一篇文章中看到将内容编码设置为UTF-8,但这并没有改变.

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

我在Windows 7 x64上运行Java 1.7.0. jmeter.log中没有产生任何感兴趣的内容,wireshark告诉我JMeter没有发送请求.

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.

推荐答案

事实证明,这是一个错误,JMeter的好伙伴能够很快修复:

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.

这篇关于使用HTTP Put方法的JMeter文件上传不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆