我在jmeter的响应数据选项卡中不断收到以下错误:
org.apache.http.client.ClientProtocolException
at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:909)
at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:805)
at org.apache.jmeter.protocol.http.sampler.HTTPHC4Impl.executeRequest(HTTPHC4Impl.java:481)
at org.apache.jmeter.protocol.http.sampler.HTTPHC4Impl.sample(HTTPHC4Impl.java:298)
at org.apache.jmeter.protocol.http.sampler.HTTPSamplerProxy.sample(HTTPSamplerProxy.java:74)
at org.apache.jmeter.protocol.http.sampler.HTTPSamplerBase.sample(HTTPSamplerBase.java:1105)
at org.apache.jmeter.protocol.http.sampler.HTTPSamplerBase.sample(HTTPSamplerBase.java:1094)
at org.apache.jmeter.threads.JMeterThread.process_sampler(JMeterThread.java:429)
at org.apache.jmeter.threads.JMeterThread.run(JMeterThread.java:257)
at java.lang.Thread.run(Unknown Source)
Caused by: org.apache.http.ProtocolException: Transfer-encoding header already present
at org.apache.http.protocol.RequestContent.process(RequestContent.java:93)
at org.apache.http.protocol.ImmutableHttpProcessor.process(ImmutableHttpProcessor.java:109)
at org.apache.http.protocol.HttpRequestExecutor.preProcess(HttpRequestExecutor.java:176)
at org.apache.http.impl.client.DefaultRequestDirector.execute(DefaultRequestDirector.java:518)
at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:906)
... 9 more
我的测试脚本是通过JMeter代理创建的。测试是通过POST将多部分数据(jpg图像)发送到REST API资源。由JMeter中的录制控制器自动创建的HTTP标头管理器具有以下内容:
Transfer-Encoding : chunked
Accept : application/json
Accept-Encoding : gzip, deflate
知道为什么Response会出错?
请求:
POST http://localhost:8080/email/v2/client/user/name/loadtest1@test.net/
POST data:
--oYtJU-XXTgMSkyaIrRBYNXw8AfMA2nMQSzJ20bJr--
Cookie Data:
JSESSIONID=b3bb843e-dafd-4cc5-8b0b-045c490736f8
Request Headers:
Connection: keep-alive
Transfer-Encoding: chunked
Accept: application/json
Accept-Encoding: gzip, deflate
答案 0 :(得分:1)
尝试从HTTP标头管理器中删除Transfer-Encoding标头。
您可以在问题中向您显示Http请求吗?和其中的标题管理员?
答案 1 :(得分:0)
失败的http请求的以下参数的状态是什么:
您在测试计划的其他地方没有任何HTTP标头管理器实例,对吗?好像是,它可能会干扰,因为HTTP标头管理器的范围不仅限于一个采样器,只有当它没有作为子项添加时。
您的帖子请求详细信息看起来不像文件上传请求。查看Upload and Download Scenarios with Apache JMeter指南,了解您是否遗漏了重要内容。
切勿在同一台计算机上运行负载生成器和正在测试的应用程序。即使在开发或调试测试时也是如此。