java.net.ConnectException:连接被拒绝:在Jmeter上进行负载测试时发生连接错误

时间:2017-02-15 15:03:14

标签: jmeter

我使用了django web service post方法。我想加载多个线程用户ex(100)同时加载。加速时间为1秒。循环次数为1。

java.net.ConnectException: Connection refused: connect
    at java.net.DualStackPlainSocketImpl.connect0(Native Method)
    at java.net.DualStackPlainSocketImpl.socketConnect(Unknown Source)
    at java.net.AbstractPlainSocketImpl.doConnect(Unknown Source
    at java.net.AbstractPlainSocketImpl.connectToAddress(Unknown Source)
    at java.net.AbstractPlainSocketImpl.connect(Unknown Source)
    at java.net.PlainSocketImpl.connect(Unknown Source)
    at java.net.SocksSocketImpl.connect(Unknown Source)
    at java.net.Socket.connect(Unknown Source)
    at org.apache.http.conn.scheme.PlainSocketFactory.connectSocket‌​(PlainSocketFactory.‌​java:120)
    at org.apache.http.impl.conn.DefaultClientConnectionOperator.op‌​enConnection(Default‌​ClientConnectionOper‌​ator.java:179)
    at org.apache.http.impl.conn.ManagedClientConnectionImpl.open(M‌​anagedClientConnecti‌​onImpl.java:328)
    at org.apache.jmeter.protocol.http.sampler.MeasuringConnectionM‌​anager$MeasuredConne‌​ction.open(Measuring‌​ConnectionManager.ja‌​va:114)
    at org.apache.http.impl.client.DefaultRequestDirector.tryConnec‌​t(DefaultRequestDire‌​ctor.java:612)
    at org.apache.http.impl.client.DefaultRequestDirector.execute(D‌​efaultRequestDirecto‌​r.java:447)
    at org.apache.http.impl.client.AbstractHttpClient.doExecute(Abs‌​tractHttpClient.java‌​:884)
    at org.apache.http.impl.client.CloseableHttpClient.execute(Clos‌​eableHttpClient.java‌​:82)
    at org.apache.http.impl.client.CloseableHttpClient.execute(Clos‌​eableHttpClient.java‌​:55)
    at org.apache.jmeter.protocol.http.sampler.HTTPHC4Impl.executeR‌​equest(HTTPHC4Impl.j‌​ava:654)
    at org.apache.jmeter.protocol.http.sampler.HTTPHC4Impl.sample(H‌​TTPHC4Impl.java:413)
    at org.apache.jmeter.protocol.http.sampler.HTTPSamplerProxy.sam‌​ple(HTTPSamplerProxy‌​.java:74)
    at org.apache.jmeter.protocol.http.sampler.HTTPSamplerBase.samp‌​le(HTTPSamplerBase.j‌​ava:1166)
    at org.apache.jmeter.protocol.http.sampler.HTTPSamplerBase.samp‌​le(HTTPSamplerBase.j‌​ava:1155)
    at org.apache.jmeter.threads.JMeterThread.executeSamplePackage(‌​JMeterThread.java:47‌​5)
    at org.apache.jmeter.threads.JMeterThread.processSampler(JMeter‌​Thread.java:418)
    at org.apache.jmeter.threads.JMeterThread.run(JMeterThread.java‌​:249)
    at java.lang.Thread.run(Unknown Source)

1 个答案:

答案 0 :(得分:0)

由于许多原因导致连接被拒绝错误。

请参阅JMeter监听器中收到的响应代码(查看结果树)。如果它的响应代码是200,并且您收到此错误,则表示您的JMeter脚本存在问题,那么您应该将您的想法路由到JMeter中的代理服务器设置,但如果响应代码不是200,则表示存在您的申请有问题。