Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

The target server failed to respond - Jmeter

Tags:

jmeter

i am running a load test using Jmeter 2.10 on a web application.

I have a HTTP sampler with View results tree listener and I am running behind corporate proxy.

When i run the thread group even with a single thread,

org.apache.http.NoHttpResponseException: The target server failed to respond
    at org.apache.http.impl.conn.DefaultHttpResponseParser.parseHead(DefaultHttpResponseParser.java:95)
    at org.apache.http.impl.conn.DefaultHttpResponseParser.parseHead(DefaultHttpResponseParser.java:61)
    at org.apache.http.impl.io.AbstractMessageParser.parse(AbstractMessageParser.java:254)
    at org.apache.http.impl.AbstractHttpClientConnection.receiveResponseHeader(AbstractHttpClientConnection.java:289)
    at org.apache.http.impl.conn.DefaultClientConnection.receiveResponseHeader(DefaultClientConnection.java:252)
    at org.apache.http.impl.conn.ManagedClientConnectionImpl.receiveResponseHeader(ManagedClientConnectionImpl.java:191)
    at org.apache.http.protocol.HttpRequestExecutor.doReceiveResponse(HttpRequestExecutor.java:300)
    at org.apache.http.protocol.HttpRequestExecutor.execute(HttpRequestExecutor.java:127)
    at org.apache.http.impl.client.DefaultRequestDirector.tryExecute(DefaultRequestDirector.java:715)
    at org.apache.http.impl.client.DefaultRequestDirector.execute(DefaultRequestDirector.java:520)
    at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:906)
    at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:805)
    at org.apache.jmeter.protocol.http.sampler.HTTPHC4Impl.executeRequest(HTTPHC4Impl.java:475)
    at org.apache.jmeter.protocol.http.sampler.HTTPHC4Impl.sample(HTTPHC4Impl.java:295)
    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)

Please Advice

like image 209
user67867 Avatar asked Aug 05 '14 06:08

user67867


2 Answers

I faced the same issue "target server failed to respond" and here is what I did:

  1. In your JMETER test plan you must have added 'HTTP Request Defaults". Click on that and for the Implementation field select HttpClient4 option from the dropdown.

  2. Save your test

  3. Now in the apache jmeter's bin folder open the file user.properties and make an entry towards the end of the file as follows:

    • httpclient4.retrycount=1
    • hc.parameters.file=hc.parameters
  4. Now open the file hc.parameters with the same bin folder and make an entry

    • http.connection.stalecheck$Boolean=true
  5. Save these files

  6. Restart jmeter

The above steps helped me resolving the problem.

I got the solution from https://wiki.apache.org/jmeter/JMeterSocketClosed

like image 114
user3914733 Avatar answered Oct 27 '22 19:10

user3914733


You need to "tell" JMeter to use your corporate proxy via command-line arguments:

As per How do I run JMeter in non-gui mode guide

    -H, --proxyHost <argument>
            Set a proxy server for JMeter to use
    -P, --proxyPort <argument>
            Set proxy server port for JMeter to use
    -N, --nonProxyHosts <argument>
            Set nonproxy host list (e.g. *.apache.org|localhost)
    -u, --username <argument>
            Set username for proxy server that JMeter is to use
    -a, --password <argument>

So something like

jmeter -H 10.10.10.1 -P 3128 

will tell JMeter to use 10.10.10.1:3128 as a proxy. Replace IP and port with the ones from your corporate network.

like image 1
Dmitri T Avatar answered Oct 27 '22 18:10

Dmitri T