当我点击表单的提交按钮时,我会收到Exception。在google上搜索更多内容后,看起来当服务器没有响应HTMLUnit提交的请求时会抛出此异常。我正在使用HTMLUnit 2.9。
java.lang.RuntimeException:org.apache.http.NoHttpResponseException:目标服务器无法响应 在com.gargoylesoftware.htmlunit.WebClient.download(WebClient.java:2131) 在com.gargoylesoftware.htmlunit.html.HtmlForm.submit(HtmlForm.java:135) 在com.gargoylesoftware.htmlunit.html.HtmlSubmitInput.doClickAction(HtmlSubmitInput.java:75) 在com.gargoylesoftware.htmlunit.html.HtmlElement.click(HtmlElement.java:1244) 在com.gargoylesoftware.htmlunit.html.HtmlElement.click(HtmlElement.java:1195) 在com.gargoylesoftware.htmlunit.html.HtmlElement.click(HtmlElement.java:1158) 在com.quinstreet.dms.qaautomationtool.testengine.LeadSubmitter.submitForm(LeadSubmitter.java:1518) at com.quinstreet.dms.qaautomationtool.testengine.LeadSubmitter.processFodPage(LeadSubmitter.java:627) 在com.quinstreet.dms.qaautomationtool.testengine.LeadSubmitter.submitLead(LeadSubmitter.java:431) 在com.quinstreet.dms.qaautomationtool.testengine.LeadSubmitter.run(LeadSubmitter.java:174) 在com.quinstreet.dms.qaautomationtool.util.ThreadPool $ PooledThread.run(ThreadPool.java:123)
引起:org.apache.http.NoHttpResponseException:目标服务器无法响应 at org.apache.http.impl.conn.DefaultResponseParser.parseHead(DefaultResponseParser.java:101) 在org.apache.http.impl.io.AbstractMessageParser.parse(AbstractMessageParser.java:252) at org.apache.http.impl.AbstractHttpClientConnection.receiveResponseHeader(AbstractHttpClientConnection.java:281) at org.apache.http.impl.conn.DefaultClientConnection.receiveResponseHeader(DefaultClientConnection.java:247) at org.apache.http.impl.conn.AbstractClientConnAdapter.receiveResponseHeader(AbstractClientConnAdapter.java:219) at org.apache.http.protocol.HttpRequestExecutor.doReceiveResponse(HttpRequestExecutor.java:298) 在org.apache.http.protocol.HttpRequestExecutor.execute(HttpRequestExecutor.java:125) at 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.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:776) 在com.gargoylesoftware.htmlunit.HttpWebConnection.getResponse(HttpWebConnection.java:152) 在com.gargoylesoftware.htmlunit.WebClient.loadWebResponseFromWebConnection(WebClient.java:1439) 在com.gargoylesoftware.htmlunit.WebClient.loadWebResponse(WebClient.java:1358) 在com.gargoylesoftware.htmlunit.WebClient.download(WebClient.java:2127)
请提供解决方案或解决此问题的任何线索。