org.apache.http.NoHttpResponseException: The target server failed to respond

6,062 views
Skip to first unread message

Tony

unread,
Jul 11, 2011, 11:54:52 PM7/11/11
to Selenium Users
hi all,

I'm not sure why my testing code always throw exception as below on
Today. But yesterday is ok. It just failed on "new
InternetExplorerDriver();". Could you give me help. I have test using
FirefoxDriver, it is ok.



[DEBUG] [2011-07-12 11:49:13] [ Class =
org.apache.http.impl.client.DefaultRequestDirector | Method = execute
| Line = 496 ] | The target server failed to respond |
org.apache.http.NoHttpResponseException: The target server failed to
respond
at
org.apache.http.impl.conn.DefaultResponseParser.parseHead(DefaultResponseParser.java:
101)
at
org.apache.http.impl.io.AbstractMessageParser.parse(AbstractMessageParser.java:
210)
at
org.apache.http.impl.AbstractHttpClientConnection.receiveResponseHeader(AbstractHttpClientConnection.java:
271)
at
org.apache.http.impl.conn.DefaultClientConnection.receiveResponseHeader(DefaultClientConnection.java:
233)
at
org.apache.http.impl.conn.AbstractClientConnAdapter.receiveResponseHeader(AbstractClientConnAdapter.java:
209)
at
org.apache.http.protocol.HttpRequestExecutor.doReceiveResponse(HttpRequestExecutor.java:
292)
at
org.apache.http.protocol.HttpRequestExecutor.execute(HttpRequestExecutor.java:
126)
at
org.apache.http.impl.client.DefaultRequestDirector.execute(DefaultRequestDirector.java:
483)
at
org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:
641)
at
org.openqa.selenium.remote.HttpCommandExecutor.followRedirects(HttpCommandExecutor.java:
313)
at
org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:
254)
at
org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:
382)
at
org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:
101)
at
org.openqa.selenium.ie.InternetExplorerDriver.setup(InternetExplorerDriver.java:
103)
at
org.openqa.selenium.ie.InternetExplorerDriver.<init>(InternetExplorerDriver.java:
61)

bpant

unread,
Sep 19, 2011, 5:45:28 PM9/19/11
to seleniu...@googlegroups.com
I am seeing this with Selenium 2.6.0, after upgrading from 2.5.0

ChaotX

unread,
Sep 20, 2011, 9:50:35 AM9/20/11
to Selenium Users
I'm seeing this also.
Mostly while chromedriver is used (it happenes 1-2% in the tests
randomly). I experienced this on both XP and Win7.
If I used chrome driver with FF driver the same time on the same VM it
happened more frequently.
It is totally random when I get this error. I've seen this error while
findElements, click, executescript.... were used. This makes our
chrome tests unstable.
I exclude the local network problems because in that case this should
happen also when Firefox tests run.

Grid is running on a MacMini with Lion. I use json config files for
both grid and node setup, but nothing special in it, copies of the
ones found in the server-standalone jar file with port number, ip
address and actual capabilities modifications.

Here is the last stack trace I got:

org.openqa.selenium.WebDriverException: The target server failed to
respond; duration or timeout: 3.28 seconds
Build info: version: '2.6.0', revision: '13840', time: '2011-09-13
14:55:30'
System info: os.name: 'Windows 7', os.arch: 'x86', os.version: '6.1',
java.version: '1.7.0'
Driver info: driver.version: RemoteWebDriver
sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:
57)
sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:
45)
java.lang.reflect.Constructor.newInstance(Constructor.java:525)
org.openqa.selenium.remote.ErrorHandler.createThrowable(ErrorHandler.java:
147)
org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:
113)
org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:
397)
org.openqa.selenium.remote.RemoteWebDriver.findElement(RemoteWebDriver.java:
182)
org.openqa.selenium.remote.RemoteWebDriver.findElementByCssSelector(RemoteWebDriver.java:
247)
org.openqa.selenium.By$ByCssSelector.findElement(By.java:401)
org.openqa.selenium.remote.RemoteWebDriver.findElement(RemoteWebDriver.java:
174)
com.Selena.utilities.Utilities.isVisible(Utilities.java:252)
com.Selena.utilities.Utilities$5.apply(Utilities.java:458)
com.Selena.utilities.Utilities$5.apply(Utilities.java:455)
org.openqa.selenium.support.ui.FluentWait.until(FluentWait.java:173)
com.Selena.utilities.Utilities.waitForVisible(Utilities.java:453)
com.Selena.utilities.Utilities.waitForVisible(Utilities.java:423)
com.Selena.BasePage.waitForVisible(BasePage.java:426)
com.Selena.BasePage.waitForVisible(BasePage.java:446)
com.Selena.BasePage.preClickEvents(BasePage.java:602)
com.Selena.BasePage.click(BasePage.java:655)
com.Selena.BasePage.click(BasePage.java:626)
com.Selena.BasePage.click(BasePage.java:613)
com.*********v3.tests.basetest.*********V3BaseTest.startSelenium(*********V3BaseTest.java:
159)
com.Selena.BaseFunctionality.setUp(BaseFunctionality.java:292)
com.*********v3.tests.basetest.*********V3BaseTest.setUp(*********V3BaseTest.java:
143)
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:
57)
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:
43)
java.lang.reflect.Method.invoke(Method.java:601)
org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:
76)
org.testng.internal.Invoker.invokeConfigurationMethod(Invoker.java:
525)
org.testng.internal.Invoker.invokeConfigurations(Invoker.java:202)
org.testng.internal.Invoker.invokeMethod(Invoker.java:613)
org.testng.internal.Invoker.invokeTestMethod(Invoker.java:846)
org.testng.internal.Invoker.invokeTestMethods(Invoker.java:1170)
org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:
125)
org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:109)
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:
1110)
java.util.concurrent.ThreadPoolExecutor
$Worker.run(ThreadPoolExecutor.java:603)
java.lang.Thread.run(Thread.java:722)

Caused by: org.openqa.selenium.remote.ScreenshotException: Screen shot
has been taken
Build info: version: '2.6.0', revision: '13840', time: '2011-09-13
14:55:30'
System info: os.name: 'Windows 7', os.arch: 'x86', os.version: '6.1',
java.version: '1.7.0'
Driver info: driver.version: RemoteWebDriver
org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:
101)
org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:
397)
org.openqa.selenium.remote.RemoteWebDriver.findElement(RemoteWebDriver.java:
182)
org.openqa.selenium.remote.RemoteWebDriver.findElementByCssSelector(RemoteWebDriver.java:
247)
org.openqa.selenium.By$ByCssSelector.findElement(By.java:401)
org.openqa.selenium.remote.RemoteWebDriver.findElement(RemoteWebDriver.java:
174)
com.Selena.utilities.Utilities.isVisible(Utilities.java:252)
com.Selena.utilities.Utilities$5.apply(Utilities.java:458)
com.Selena.utilities.Utilities$5.apply(Utilities.java:455)
org.openqa.selenium.support.ui.FluentWait.until(FluentWait.java:173)
com.Selena.utilities.Utilities.waitForVisible(Utilities.java:453)
com.Selena.utilities.Utilities.waitForVisible(Utilities.java:423)
com.Selena.BasePage.waitForVisible(BasePage.java:426)
com.Selena.BasePage.waitForVisible(BasePage.java:446)
com.Selena.BasePage.preClickEvents(BasePage.java:602)
com.Selena.BasePage.click(BasePage.java:655)
com.Selena.BasePage.click(BasePage.java:626)
com.Selena.BasePage.click(BasePage.java:613)
com.*********v3.tests.basetest.*********V3BaseTest.startSelenium(*********V3BaseTest.java:
159)
com.Selena.BaseFunctionality.setUp(BaseFunctionality.java:292)
com.*********v3.tests.basetest.*********V3BaseTest.setUp(*********V3BaseTest.java:
143)
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:
57)
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:
43)
java.lang.reflect.Method.invoke(Method.java:601)
org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:
76)
org.testng.internal.Invoker.invokeConfigurationMethod(Invoker.java:
525)
org.testng.internal.Invoker.invokeConfigurations(Invoker.java:202)
org.testng.internal.Invoker.invokeMethod(Invoker.java:613)
org.testng.internal.Invoker.invokeTestMethod(Invoker.java:846)
org.testng.internal.Invoker.invokeTestMethods(Invoker.java:1170)
org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:
125)
org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:109)
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:
1110)
java.util.concurrent.ThreadPoolExecutor
$Worker.run(ThreadPoolExecutor.java:603)
java.lang.Thread.run(Thread.java:722)

Caused by: org.apache.http.NoHttpResponseException: The target server
failed to respond
org.apache.http.impl.conn.DefaultResponseParser.parseHead(DefaultResponseParser.java:
101)
org.apache.http.impl.io.AbstractMessageParser.parse(AbstractMessageParser.java:
252)
org.apache.http.impl.AbstractHttpClientConnection.receiveResponseHeader(AbstractHttpClientConnection.java:
281)
org.apache.http.impl.conn.DefaultClientConnection.receiveResponseHeader(DefaultClientConnection.java:
247)
org.apache.http.impl.conn.AbstractClientConnAdapter.receiveResponseHeader(AbstractClientConnAdapter.java:
219)
org.apache.http.protocol.HttpRequestExecutor.doReceiveResponse(HttpRequestExecutor.java:
298)
org.apache.http.protocol.HttpRequestExecutor.execute(HttpRequestExecutor.java:
125)
org.apache.http.impl.client.DefaultRequestDirector.tryExecute(DefaultRequestDirector.java:
645)
org.apache.http.impl.client.DefaultRequestDirector.execute(DefaultRequestDirector.java:
464)
org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:
820)
org.openqa.selenium.remote.HttpCommandExecutor.fallBackExecute(HttpCommandExecutor.java:
390)
org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:
369)
org.openqa.selenium.chrome.ChromeCommandExecutor.execute(ChromeCommandExecutor.java:
50)
org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:
377)
org.openqa.selenium.remote.RemoteWebDriver.findElement(RemoteWebDriver.java:
182)
org.openqa.selenium.remote.RemoteWebDriver.findElementByCssSelector(RemoteWebDriver.java:
247)
org.openqa.selenium.By$ByCssSelector.findElement(By.java:401)
org.openqa.selenium.remote.RemoteWebDriver.findElement(RemoteWebDriver.java:
174)
sun.reflect.GeneratedMethodAccessor16.invoke(Unknown Source)
sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
java.lang.reflect.Method.invoke(Unknown Source)
org.openqa.selenium.support.events.EventFiringWebDriver
$2.invoke(EventFiringWebDriver.java:98)
$Proxy1.findElement(Unknown Source)
org.openqa.selenium.support.events.EventFiringWebDriver.findElement(EventFiringWebDriver.java:
177)
org.openqa.selenium.remote.server.handler.FindElement.call(FindElement.java:
48)
org.openqa.selenium.remote.server.handler.FindElement.call(FindElement.java:
1)
java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source)
java.util.concurrent.FutureTask.run(Unknown Source)
java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)
java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
java.lang.Thread.run(Unknown Source)

I use RemoteWebDriver because of the grid2 setup. But could not run a
lot IE tests because a java runtime error used to kill the node about
the same frequent as this exception happens in chrome.
But that's should be an other issue but I could not find any solution
for that neither.

Daniel Wagner-Hall

unread,
Sep 21, 2011, 7:41:07 AM9/21/11
to Selenium Users
We updated the Apache HttpClient library from version 4.0.3 to 4.1.2
because we updated HtmlUnit from 2.8 to 2.9. An interaction between
the Apache HttpClient 4.1.2 and the web server embedded in the
ChromeDriver and InternetExplorerDriver is causing this problem.

I have a fix for this for the ChromeDriver which should be in the next
ChromeDriver release. I will look at porting it to the
InternetExplorerDriver.

In the mean time, if you're not using the HtmlUnitDriver, if you
replace the Apache HttpClient 4.1.2 jar in your classpath with the
4.0.3 jar, these exceptions should stop happening.

Daniel Wagner-Hall

unread,
Sep 21, 2011, 7:54:06 AM9/21/11
to Selenium Users
https://code.google.com/p/selenium/issues/detail?id=2513 has a
workaround, and will be updated as the issue gets fixed

On Sep 20, 2:50 pm, ChaotX <ferenc.lom...@gmail.com> wrote:
> I'm seeing this also.
> Mostly while chromedriver is used (it happenes 1-2% in the tests
> randomly). I experienced this on both XP and Win7.
> If I used chrome driver with FF driver the same time on the same VM it
> happened more frequently.
> It is totally random when I get this error. I've seen this error while
> findElements, click, executescript.... were used. This makes our
> chrome tests unstable.
> I exclude the local network problems because in that case this should
> happen also when Firefox tests run.
>
> Grid is running on a MacMini with Lion. I use json config files for
> both grid and node setup, but nothing special in it, copies of the
> ones found in the server-standalone jar file with port number, ip
> address and actual capabilities modifications.
>
> Here is the last stack trace I got:
>
> org.openqa.selenium.WebDriverException: The target server failed to
> respond; duration or timeout: 3.28 seconds
> Build info: version: '2.6.0', revision: '13840', time: '2011-09-13
> 14:55:30'
> System info: os.name: 'Windows 7', os.arch: 'x86', os.version: '6.1',
> java.version: '1.7.0'
> Driver info: driver.version: RemoteWebDriver
> sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
> sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAcce ssorImpl.java:
> 57)
> sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstru ctorAccessorImpl.java:
> com.*********v3.tests.basetest.*********V3BaseTest.startSelenium(*********V 3BaseTest.java:
> 159)
> com.Selena.BaseFunctionality.setUp(BaseFunctionality.java:292)
> com.*********v3.tests.basetest.*********V3BaseTest.setUp(*********V3BaseTes t.java:
> 143)
> sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:
> 57)
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImp l.java:
> 43)
> java.lang.reflect.Method.invoke(Method.java:601)
> org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHel per.java:
> 247)
> org.openqa.selenium.By$ByCssSelector.findElement(By.java:401)
> org.openqa.selenium.remote.RemoteWebDriver.findElement(RemoteWebDriver.java :
> 174)
> com.Selena.utilities.Utilities.isVisible(Utilities.java:252)
> com.Selena.utilities.Utilities$5.apply(Utilities.java:458)
> com.Selena.utilities.Utilities$5.apply(Utilities.java:455)
> org.openqa.selenium.support.ui.FluentWait.until(FluentWait.java:173)
> com.Selena.utilities.Utilities.waitForVisible(Utilities.java:453)
> com.Selena.utilities.Utilities.waitForVisible(Utilities.java:423)
> com.Selena.BasePage.waitForVisible(BasePage.java:426)
> com.Selena.BasePage.waitForVisible(BasePage.java:446)
> com.Selena.BasePage.preClickEvents(BasePage.java:602)
> com.Selena.BasePage.click(BasePage.java:655)
> com.Selena.BasePage.click(BasePage.java:626)
> com.Selena.BasePage.click(BasePage.java:613)
> com.*********v3.tests.basetest.*********V3BaseTest.startSelenium(*********V 3BaseTest.java:
> 159)
> com.Selena.BaseFunctionality.setUp(BaseFunctionality.java:292)
> com.*********v3.tests.basetest.*********V3BaseTest.setUp(*********V3BaseTes t.java:
> 143)
> sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:
> 57)
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImp l.java:
> 43)
> java.lang.reflect.Method.invoke(Method.java:601)
> org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHel per.java:
> 76)
> org.testng.internal.Invoker.invokeConfigurationMethod(Invoker.java:
> 525)
> org.testng.internal.Invoker.invokeConfigurations(Invoker.java:202)
> org.testng.internal.Invoker.invokeMethod(Invoker.java:613)
> org.testng.internal.Invoker.invokeTestMethod(Invoker.java:846)
> org.testng.internal.Invoker.invokeTestMethods(Invoker.java:1170)
> org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.jav a:
> 125)
> org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:109)
> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:
> 1110)
> java.util.concurrent.ThreadPoolExecutor
> $Worker.run(ThreadPoolExecutor.java:603)
> java.lang.Thread.run(Thread.java:722)
>
> Caused by: org.apache.http.NoHttpResponseException: The target server
> failed to respond

ChaotX

unread,
Sep 21, 2011, 11:28:22 AM9/21/11
to Selenium Users
Hi Daniel!

Thank you for the clarification.
Unfortunately I tried to rollback to the apache httpclient 4.0.3, in
the standalone jar, but the grid2 also uses some of the 4.1.x
features:

Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/
http/client/RedirectStrategy
at org.openqa.grid.internal.Registry.<init>(Registry.java:84)
at org.openqa.grid.internal.Registry.newInstance(Registry.java:
94)
at org.openqa.grid.web.Hub.<init>(Hub.java:97)
at
org.openqa.grid.selenium.GridLauncher.main(GridLauncher.java:47)
Caused by: java.lang.ClassNotFoundException:
org.apache.http.client.RedirectStrategy
at java.net.URLClassLoader$1.run(Unknown Source)
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
... 4 more

Did you tried to use this through the grid, or locally?
Nevertheless the knowledge of the cause of this problem saved a lot of
my nerve-cells, thank you again:)

On Sep 21, 1:54 pm, Daniel Wagner-Hall <dawag...@gmail.com> wrote:
> https://code.google.com/p/selenium/issues/detail?id=2513has a
> ...
>
> read more »

Daniel Wagner-Hall

unread,
Sep 21, 2011, 4:09:55 PM9/21/11
to Selenium Users
You will need to roll back to httpclient 4.0.3 as well as httpcore
4.0.3, possibly also httpmime back to 4.0.1, and maybe commons lang
back to 2.4
> ...
>
> read more »

tigertester

unread,
Sep 27, 2011, 3:23:44 PM9/27/11
to seleniu...@googlegroups.com
Daniel,

Is it in the Meta-Inf dependency files that I need to make these changes?

Regards
Reply all
Reply to author
Forward
0 new messages