【问题标题】:POST Call works in Postman, but JMeter throws HTTP NoHttpResponseException errorPOST Call 在 Postman 中有效,但 JMeter 抛出 HTTP NoHttpResponseException 错误
【发布时间】:2020-09-15 21:26:57
【问题描述】:

对于负载测试,我一直在准备不同的 POST 调用。首先在 Postman 中(因为我发现它对用户更友好),一旦成功,我就一直在 Jmeter 中设置我的实际负载测试。在 Postman 中,我始终得到所需的响应,但在 Jmeter 中,我收到以下错误:

org.apache.http.NoHttpResponseException: (servername here):443 failed to respond at org.apache.http.impl.conn.DefaultHttpResponseParser.parseHead(DefaultHttpResponseParser.java:141) at org.apache.http.impl.conn.DefaultHttpResponseParser.parseHead(DefaultHttpResponseParser.java:56) at org.apache.http.impl.io.AbstractMessageParser.parse(AbstractMessageParser.java:259) at org.apache.http.impl.DefaultBHttpClientConnection.receiveResponseHeader(DefaultBHttpClientConnection.java:163) at org.apache.http.impl.conn.CPoolProxy.receiveResponseHeader(CPoolProxy.java:157) at org.apache.http.protocol.HttpRequestExecutor.doReceiveResponse(HttpRequestExecutor.java:273) at org.apache.http.protocol.HttpRequestExecutor.execute(HttpRequestExecutor.java:125) at org.apache.http.impl.execchain.MainClientExec.execute(MainClientExec.java:272) at org.apache.http.impl.execchain.ProtocolExec.execute(ProtocolExec.java:186) at org.apache.http.impl.execchain.RetryExec.execute(RetryExec.java:89) at org.apache.http.impl.execchain.RedirectExec.execute(RedirectExec.java:110) at org.apache.http.impl.client.InternalHttpClient.doExecute(InternalHttpClient.java:185) at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:83) at org.apache.jmeter.protocol.http.sampler.HTTPHC4Impl.executeRequest(HTTPHC4Impl.java:930) at org.apache.jmeter.protocol.http.sampler.HTTPHC4Impl.sample(HTTPHC4Impl.java:641) at org.apache.jmeter.protocol.http.sampler.HTTPSamplerProxy.sample(HTTPSamplerProxy.java:66) at org.apache.jmeter.protocol.http.sampler.HTTPSamplerBase.sample(HTTPSamplerBase.java:1281) at org.apache.jmeter.protocol.http.sampler.HTTPSamplerBase.sample(HTTPSamplerBase.java:1270) at org.apache.jmeter.threads.JMeterThread.doSampling(JMeterThread.java:630) at org.apache.jmeter.threads.JMeterThread.executeSamplePackage(JMeterThread.java:558) at org.apache.jmeter.threads.JMeterThread.processSampler(JMeterThread.java:489) at org.apache.jmeter.threads.JMeterThread.run(JMeterThread.java:256) at java.lang.Thread.run(Unknown Source)

到目前为止,我已经得出结论:

  1. Jmeter 中的端点与 Postman 中的端点相同
  2. Jmeter 中的 body 与 Postman 中的 body 相同
  3. 我已将完全相同的标头从 Postman 复制到 Jmeter
  4. 线程大小为 1,所以我很难相信它与服务器有关。

我有什么遗漏吗?我还能尝试什么?

【问题讨论】:

  • 尝试添加带有值的标头User-Agent(使用HTTP标头管理器)

标签: jmeter postman performance-testing load-testing


【解决方案1】:

我能想到两个可能的原因:

  1. “端点”并不完全相同,即协议/主机/端口不匹配,为了确保 JMeter 配置与 Postman 100% 匹配,只需使用 JMeter 的 HTTP(S) Test Script Recorder 记录来自 Postman 的请求,如果您configure Postman to use JMeter as the proxy JMeter 将捕获请求并创建相关的HTTP Request 采样器和HTTP Header Manager(s)
  2. 您的计算机正在使用上游(公司?)代理连接到 Internet(或 Intranet)。可能是 Postman 配置为尊重操作系统代理设置,而在 JMeter 中您需要手动指定代理,请参阅Using JMeter behind a proxy 用户手册章节了解更多详细信息

【讨论】:

    猜你喜欢
    • 2020-04-28
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-06-22
    • 2019-11-04
    • 1970-01-01
    • 1970-01-01
    • 2016-05-07
    相关资源
    最近更新 更多