使用HTTP Put方法的JMeter文件上传不起作用

编程入门 行业动态 更新时间:2024-10-25 16:28:23
本文介绍了使用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 "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的好伙伴能够很快修复: issues.apache/bugzilla/show_bug.cgi?id=52897

Turns out it was a bug that the nice folks at JMeter were able to fix very quickly: issues.apache/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文件上传不起作用

本文发布于:2023-10-29 10:28:18,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1539448.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:文件上传   不起作用   方法   HTTP   Put

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!