You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@hc.apache.org by Ravi C Chamarthy <ra...@in.ibm.com> on 2012/08/28 08:30:13 UTC

Randon "ProtocolException: The server failed to respond with a valid HTTP response" while executing the client request

Hi,

I am running a junit test case, where the test methods would submit http
client requests to the target application server (WebSphere 8) which hosts
the serving application.
While running the test case, I randomly run into the following error, where
in first run, say testA() would fail, and in a successive test run testA()
would pass but some other test method, say testB() would fail with the same
error message as listed below.
I am not sure what is happening as it not a constant error occurring for
the same method.
What's more confusing is, the Servlet listening to the HTTP requests is not
at all called when this error occurred. And also, I do not see any error
messages at the server side.

Following is the code which is used to construct the httpclient.

DefaultHttpClient httpClient = new DefaultHttpClient(_connectionManager,
null);
HttpParams params = new BasicHttpParams();
HttpProtocolParams.setVersion(params, HttpVersion.HTTP_1_1);
HttpProtocolParams.setContentCharset(params, "UTF-8");
// HttpProtocolParams.setUseExpectContinue(params, true);
HttpProtocolParams.setUseExpectContinue(params, false);
HttpConnectionParams.setTcpNoDelay(params, true);
HttpConnectionParams.setSocketBufferSize(params, 128000);

HttpConnectionParams.setStaleCheckingEnabled(params, true);
// determine the release version from packaged version info

final VersionInfo vi = VersionInfo.loadVersionInfo
("org.apache.http.client", JavaHttpServiceCreator.class.getClassLoader());
final String release = (vi != null) ? vi.getRelease() :
VersionInfo.UNAVAILABLE;
HttpProtocolParams.setUserAgent(params, "Apache-HttpClient/IIS " + release
+ " (java 1.5)");
AuthParams.setCredentialCharset(params, "UTF-8");
httpClient.setParams(params);



java.rmi.RemoteException: null; nested exception is:
	org.apache.http.client.ClientProtocolException
	at
com.ibm.iis.isf.security.auth.javahttp.JavaHttpAuthorizationService.hasAccess
(JavaHttpAuthorizationService.java:114)
	at
com.ibm.iis.isf.security.auth.AuthorizationServiceTestCases.testHasAccessSingle
(AuthorizationServiceTestCases.java:690)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke
(NativeMethodAccessorImpl.java:60)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke
(DelegatingMethodAccessorImpl.java:37)
	at java.lang.reflect.Method.invoke(Method.java:611)
	at junit.framework.TestCase.runTest(TestCase.java:168)
	at junit.framework.TestCase.runBare(TestCase.java:134)
	at junit.framework.TestResult$1.protect(TestResult.java:110)
	at junit.framework.TestResult.runProtected(TestResult.java:128)
	at junit.framework.TestResult.run(TestResult.java:113)
	at junit.framework.TestCase.run(TestCase.java:124)
	at junit.framework.TestSuite.runTest(TestSuite.java:243)
	at junit.framework.TestSuite.run(TestSuite.java:238)
	at junit.extensions.TestDecorator.basicRun(TestDecorator.java:24)
	at junit.extensions.TestSetup$1.protect(TestSetup.java:23)
	at junit.framework.TestResult.runProtected(TestResult.java:128)
	at junit.extensions.TestSetup.run(TestSetup.java:27)
	at org.junit.internal.runners.JUnit38ClassRunner.run
(JUnit38ClassRunner.java:83)
	at org.apache.maven.surefire.junit4.JUnit4TestSet.execute
(JUnit4TestSet.java:35)
	at org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet
(JUnit4Provider.java:115)
	at org.apache.maven.surefire.junit4.JUnit4Provider.invoke
(JUnit4Provider.java:97)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke
(NativeMethodAccessorImpl.java:60)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke
(DelegatingMethodAccessorImpl.java:37)
	at java.lang.reflect.Method.invoke(Method.java:611)
	at org.apache.maven.surefire.booter.ProviderFactory
$ClassLoaderProxy.invoke(ProviderFactory.java:103)
	at $Proxy0.invoke(Unknown Source)
	at org.apache.maven.surefire.booter.SurefireStarter.invokeProvider
(SurefireStarter.java:150)
	at
org.apache.maven.surefire.booter.SurefireStarter.runSuitesInProcess
(SurefireStarter.java:74)
	at org.apache.maven.surefire.booter.ForkedBooter.main
(ForkedBooter.java:69)
Caused by: org.apache.http.client.ClientProtocolException
	at org.apache.http.impl.client.AbstractHttpClient.execute
(AbstractHttpClient.java:909)
	at org.apache.http.impl.client.AbstractHttpClient.execute
(AbstractHttpClient.java:827)
	at
com.ibm.iis.isf.binding.javahttp.runtime.JavaHttpServiceCreator.callOperation
(JavaHttpServiceCreator.java:409)
	at
com.ibm.iis.isf.security.auth.javahttp.JavaHttpAuthorizationService.hasAccess
(JavaHttpAuthorizationService.java:106)
	... 30 more
Caused by: org.apache.http.ProtocolException: The server failed to respond
with a valid HTTP response
	at org.apache.http.impl.conn.DefaultHttpResponseParser.parseHead
(DefaultHttpResponseParser.java:103)
	at org.apache.http.impl.conn.DefaultHttpResponseParser.parseHead
(DefaultHttpResponseParser.java:62)
	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:713)
	at org.apache.http.impl.client.DefaultRequestDirector.execute
(DefaultRequestDirector.java:518)
	at org.apache.http.impl.client.AbstractHttpClient.execute
(AbstractHttpClient.java:906)
	... 33 more


Thanks,
Ravi Chamarthy
IBM Information Platform & Solutions
IBM Software Group
91 40 669 57140 / ravi.chamarthy@in.ibm.com


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org


Re: Randon "ProtocolException: The server failed to respond with a valid HTTP response" while executing the client request

Posted by Oleg Kalnichevski <ol...@apache.org>.
On Tue, 2012-09-04 at 11:03 +0530, Ravi C Chamarthy wrote:
> Hi Oleg,
> 
> There were many "Connection: close" response headers that I see complete
> test run, however, the successive test case executions pass, except this
> one.
> I believe Apache httpclient does a automatic retry of the connection, when
> connection is closed, but for some reason is failing in this particular
> instance.

I do not think this is a client side failure.

Oleg

> If you need any apache httpclient wire logging, please let me know.
> 
> Thanks,
> Ravi Chamarthy
> IBM Information Platform & Solutions
> IBM Software Group
> ravi.chamarthy@in.ibm.com
> 
> 
> 
> From:	Oleg Kalnichevski <ol...@apache.org>
> To:	HttpClient User Discussion <ht...@hc.apache.org>,
> Date:	09/03/2012 01:48 AM
> Subject:	Re: Randon "ProtocolException: The server failed to respond
>             with a valid HTTP response" while executing the client request
> 
> 
> 
> On Sun, 2012-09-02 at 19:01 +0530, Ravi C Chamarthy wrote:
> > Hi Oleg,
> >
> > Thanks for your response !
> >
> > I tried to capture the request/response using an HTTP Analyzer tool.
> > In the response of the prior (in the one before this failed http request)
> > http call, I see the Connection header attribute value set to 'close'.
> > However, we indeed have the following explicit call to check stale
> > connections, but still is is failing with a blank response.
> >
> 
> That basically supports my assertion. HttpClient closes the connection
> based on 'close' value of the 'Connection' header and attempts to create
> a new connection for the subsequent request. The server fails to handle
> the incoming connection on its end and drops it without a valid
> response. This still looks like a server issue to me.
> 
> Oleg
> 
> > HttpConnectionParams.setStaleCheckingEnabled(params, true);
> >
> >     <headers>
> >       <requestheaders>
> >
> >
> <header>POST /ibm/iis/isf/javahttp/checked/com.ibm.iis.isf.security.auth.AuthenticationService/login
> 
> >  HTTP/1.1</header>
> >         <header>Content-Length: 1048</header>
> >         <header>Content-Type: application/octet-stream</header>
> >         <header>Host: hyddev15:80</header>
> >         <header>Connection: Keep-Alive</header>
> >         <header>User-Agent: Apache-HttpClient/IIS 4.2 (java 1.5)</header>
> >         <header>Cookie:
> JSESSIONID=0000titWHhRyPYrO6sWcA0LST3C:-1</header>
> >         <header>Cookie2: $Version=1</header>
> >         <header>Authorization: Basic
> > YXV0aF91c2VyXzI0NkZUT18wOmF1dGhfdXNlcl8yNDZGVE9fMA==</header>
> >       </requestheaders>
> >       <responseheaders>
> >         <header>HTTP/1.1 200 OK</header>
> >         <header>X-Powered-By: Servlet/3.0</header>
> >         <header>Content-Type: application/octet-stream</header>
> >         <header>Content-Language: en-US</header>
> >         <header>Set-Cookie: LtpaToken2=JAAuivq99D
> >
> +v6sR6rfq7FlVsFPnHoMwp1hTG9Pd5FPPA7gVEzGcC4lyZaLdVrQtYIy09yVVvIScN110DpQaHOi5BLMBzGdJZZw/1a5qd
> 
> > +C7nKbfjWgUQCK6ZVbACSzHsgGdcn0trVobZ/Sl3WxiDL4kys
> >
> +cvWzTB/AmZMgarNM70tEnoav51Y1t4JCBqDq5d1K1YnFs56E6W7gJSXnOQClEqRahUW7jgvKvvHppbECMo72rDA9ftVl/d3nwrKMVXF7GxXa0w5pFMCPf
> 
> > +r4kxYPFd3sWd0shmaK2Tepe0fX05W0O93dm8/ylkdHbP02eaiMmP
> > +uLnOCCX4cHK4v7lzT0HFWdwBPvDcjgUR7HqXiakv/V0lbocsp2P/mGoL
> >
> +bwJ4j8QJSmrTI/b7MbOPIJnF9zT5/TMgASyHLKdgItNIQZB3LRP6vN4Y0YuTuD5UOLoyqYfaZHlocZBVpWSTXE8N73h4880DWKwTpleGr0WMBZRQw/39EIQu29
> 
> > +MYc4qNt2ySAXp85P8G3rdzg
> >
> +wNQJtZXD25cVYXWmtx4r5ouOu7bLbKPkON8p/jwcnk9uOtXE3bAPO1gv18LYBGBQjxBgJKN8hPR0b41/lhRjzZL86QqodHYrSURvSAgB
> 
> > +S3ynNfAfj/h5Rf6pjJyACpQKeNoWFaAJ0JmEzBK1qGlc+Ne9Q=; Path=/;
> > HttpOnly</header>
> >         <header>Set-Cookie:
> >
> X-IBM-IISSessionId=oT9YXn09/H6fquWop8A6K9VFnXL/ZSfAHRBOb5V3MqZZArOL4rErcXklDC2ToSiWWRHfSkSDNm3oNOgHu20CoDLTipBXDTrAL6n05kwpQy0jbcvMQtglMgtAXLpD
> 
> > +LqbJ1zDQPYe8UKSC4HuNSdOHc9t3oMrGksIQRtDHkwmuHQ=; Path=/;
> HttpOnly</header>
> >         <header>Transfer-Encoding: chunked</header>
> >         <header>Connection: Close</header>
> >         <header>Date: Sun, 02 Sep 2012 09:59:30 GMT</header>
> >         <header>Server: WebSphere Application Server/8.0</header>
> >         <header>Expires: Thu, 01 Dec 1994 16:00:00 GMT</header>
> >         <header>Cache-Control: no-cache=&quot;set-cookie,
> > set-cookie2&quot;</header>
> >       </responseheaders>
> >     </headers>
> >
> > Thanks,
> > Ravi Chamarthy
> > IBM Information Platform & Solutions
> > IBM Software Group
> > ravi.chamarthy@in.ibm.com
> >
> >
> >
> > From:		 Oleg Kalnichevski <ol...@apache.org>
> > To:		 httpclient-users@hc.apache.org,
> > Date:		 08/28/2012 05:10 PM
> > Subject:		 Re: Randon "ProtocolException: The server failed to
> respond
> >             with a valid HTTP response" while executing the client
> request
> >
> >
> >
> > On Tue, 2012-08-28 at 12:00 +0530, Ravi C Chamarthy wrote:
> > > Hi,
> > >
> > > I am running a junit test case, where the test methods would submit
> http
> > > client requests to the target application server (WebSphere 8) which
> > hosts
> > > the serving application.
> > > While running the test case, I randomly run into the following error,
> > where
> > > in first run, say testA() would fail, and in a successive test run
> testA
> > ()
> > > would pass but some other test method, say testB() would fail with the
> > same
> > > error message as listed below.
> > > I am not sure what is happening as it not a constant error occurring
> for
> > > the same method.
> > > What's more confusing is, the Servlet listening to the HTTP requests is
> > not
> > > at all called when this error occurred. And also, I do not see any
> error
> > > messages at the server side.
> > >
> >
> > This exception is thrown when the server simply drops the connection in
> > the middle of HTTP exchange without responding in any meaningful way.
> > Quite often that can happen when the server is unable to accept new
> > incoming connections due to overload or an internal problem of some
> > sort. The servlet never gets called because the connection gets dropped
> > by WebSphere's HTTP stack before control is passed to your web
> > application.
> >
> > Oleg
> >
> > PS: Please do _not_ cross post.
> >
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
> > For additional commands, e-mail: httpclient-users-help@hc.apache.org
> >
> >
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
> > For additional commands, e-mail: httpclient-users-help@hc.apache.org
> >
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
> For additional commands, e-mail: httpclient-users-help@hc.apache.org
> 
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
> For additional commands, e-mail: httpclient-users-help@hc.apache.org
> 



---------------------------------------------------------------------
To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
For additional commands, e-mail: httpclient-users-help@hc.apache.org


Re: Randon "ProtocolException: The server failed to respond with a valid HTTP response" while executing the client request

Posted by Ravi C Chamarthy <ra...@in.ibm.com>.
Hi Oleg,

There were many "Connection: close" response headers that I see complete
test run, however, the successive test case executions pass, except this
one.
I believe Apache httpclient does a automatic retry of the connection, when
connection is closed, but for some reason is failing in this particular
instance.
If you need any apache httpclient wire logging, please let me know.

Thanks,
Ravi Chamarthy
IBM Information Platform & Solutions
IBM Software Group
ravi.chamarthy@in.ibm.com



From:	Oleg Kalnichevski <ol...@apache.org>
To:	HttpClient User Discussion <ht...@hc.apache.org>,
Date:	09/03/2012 01:48 AM
Subject:	Re: Randon "ProtocolException: The server failed to respond
            with a valid HTTP response" while executing the client request



On Sun, 2012-09-02 at 19:01 +0530, Ravi C Chamarthy wrote:
> Hi Oleg,
>
> Thanks for your response !
>
> I tried to capture the request/response using an HTTP Analyzer tool.
> In the response of the prior (in the one before this failed http request)
> http call, I see the Connection header attribute value set to 'close'.
> However, we indeed have the following explicit call to check stale
> connections, but still is is failing with a blank response.
>

That basically supports my assertion. HttpClient closes the connection
based on 'close' value of the 'Connection' header and attempts to create
a new connection for the subsequent request. The server fails to handle
the incoming connection on its end and drops it without a valid
response. This still looks like a server issue to me.

Oleg

> HttpConnectionParams.setStaleCheckingEnabled(params, true);
>
>     <headers>
>       <requestheaders>
>
>
<header>POST /ibm/iis/isf/javahttp/checked/com.ibm.iis.isf.security.auth.AuthenticationService/login

>  HTTP/1.1</header>
>         <header>Content-Length: 1048</header>
>         <header>Content-Type: application/octet-stream</header>
>         <header>Host: hyddev15:80</header>
>         <header>Connection: Keep-Alive</header>
>         <header>User-Agent: Apache-HttpClient/IIS 4.2 (java 1.5)</header>
>         <header>Cookie:
JSESSIONID=0000titWHhRyPYrO6sWcA0LST3C:-1</header>
>         <header>Cookie2: $Version=1</header>
>         <header>Authorization: Basic
> YXV0aF91c2VyXzI0NkZUT18wOmF1dGhfdXNlcl8yNDZGVE9fMA==</header>
>       </requestheaders>
>       <responseheaders>
>         <header>HTTP/1.1 200 OK</header>
>         <header>X-Powered-By: Servlet/3.0</header>
>         <header>Content-Type: application/octet-stream</header>
>         <header>Content-Language: en-US</header>
>         <header>Set-Cookie: LtpaToken2=JAAuivq99D
>
+v6sR6rfq7FlVsFPnHoMwp1hTG9Pd5FPPA7gVEzGcC4lyZaLdVrQtYIy09yVVvIScN110DpQaHOi5BLMBzGdJZZw/1a5qd

> +C7nKbfjWgUQCK6ZVbACSzHsgGdcn0trVobZ/Sl3WxiDL4kys
>
+cvWzTB/AmZMgarNM70tEnoav51Y1t4JCBqDq5d1K1YnFs56E6W7gJSXnOQClEqRahUW7jgvKvvHppbECMo72rDA9ftVl/d3nwrKMVXF7GxXa0w5pFMCPf

> +r4kxYPFd3sWd0shmaK2Tepe0fX05W0O93dm8/ylkdHbP02eaiMmP
> +uLnOCCX4cHK4v7lzT0HFWdwBPvDcjgUR7HqXiakv/V0lbocsp2P/mGoL
>
+bwJ4j8QJSmrTI/b7MbOPIJnF9zT5/TMgASyHLKdgItNIQZB3LRP6vN4Y0YuTuD5UOLoyqYfaZHlocZBVpWSTXE8N73h4880DWKwTpleGr0WMBZRQw/39EIQu29

> +MYc4qNt2ySAXp85P8G3rdzg
>
+wNQJtZXD25cVYXWmtx4r5ouOu7bLbKPkON8p/jwcnk9uOtXE3bAPO1gv18LYBGBQjxBgJKN8hPR0b41/lhRjzZL86QqodHYrSURvSAgB

> +S3ynNfAfj/h5Rf6pjJyACpQKeNoWFaAJ0JmEzBK1qGlc+Ne9Q=; Path=/;
> HttpOnly</header>
>         <header>Set-Cookie:
>
X-IBM-IISSessionId=oT9YXn09/H6fquWop8A6K9VFnXL/ZSfAHRBOb5V3MqZZArOL4rErcXklDC2ToSiWWRHfSkSDNm3oNOgHu20CoDLTipBXDTrAL6n05kwpQy0jbcvMQtglMgtAXLpD

> +LqbJ1zDQPYe8UKSC4HuNSdOHc9t3oMrGksIQRtDHkwmuHQ=; Path=/;
HttpOnly</header>
>         <header>Transfer-Encoding: chunked</header>
>         <header>Connection: Close</header>
>         <header>Date: Sun, 02 Sep 2012 09:59:30 GMT</header>
>         <header>Server: WebSphere Application Server/8.0</header>
>         <header>Expires: Thu, 01 Dec 1994 16:00:00 GMT</header>
>         <header>Cache-Control: no-cache=&quot;set-cookie,
> set-cookie2&quot;</header>
>       </responseheaders>
>     </headers>
>
> Thanks,
> Ravi Chamarthy
> IBM Information Platform & Solutions
> IBM Software Group
> ravi.chamarthy@in.ibm.com
>
>
>
> From:		 Oleg Kalnichevski <ol...@apache.org>
> To:		 httpclient-users@hc.apache.org,
> Date:		 08/28/2012 05:10 PM
> Subject:		 Re: Randon "ProtocolException: The server failed to
respond
>             with a valid HTTP response" while executing the client
request
>
>
>
> On Tue, 2012-08-28 at 12:00 +0530, Ravi C Chamarthy wrote:
> > Hi,
> >
> > I am running a junit test case, where the test methods would submit
http
> > client requests to the target application server (WebSphere 8) which
> hosts
> > the serving application.
> > While running the test case, I randomly run into the following error,
> where
> > in first run, say testA() would fail, and in a successive test run
testA
> ()
> > would pass but some other test method, say testB() would fail with the
> same
> > error message as listed below.
> > I am not sure what is happening as it not a constant error occurring
for
> > the same method.
> > What's more confusing is, the Servlet listening to the HTTP requests is
> not
> > at all called when this error occurred. And also, I do not see any
error
> > messages at the server side.
> >
>
> This exception is thrown when the server simply drops the connection in
> the middle of HTTP exchange without responding in any meaningful way.
> Quite often that can happen when the server is unable to accept new
> incoming connections due to overload or an internal problem of some
> sort. The servlet never gets called because the connection gets dropped
> by WebSphere's HTTP stack before control is passed to your web
> application.
>
> Oleg
>
> PS: Please do _not_ cross post.
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
> For additional commands, e-mail: httpclient-users-help@hc.apache.org
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
> For additional commands, e-mail: httpclient-users-help@hc.apache.org
>



---------------------------------------------------------------------
To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
For additional commands, e-mail: httpclient-users-help@hc.apache.org




---------------------------------------------------------------------
To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
For additional commands, e-mail: httpclient-users-help@hc.apache.org


Re: Randon "ProtocolException: The server failed to respond with a valid HTTP response" while executing the client request

Posted by Oleg Kalnichevski <ol...@apache.org>.
On Sun, 2012-09-02 at 19:01 +0530, Ravi C Chamarthy wrote:
> Hi Oleg,
> 
> Thanks for your response !
> 
> I tried to capture the request/response using an HTTP Analyzer tool.
> In the response of the prior (in the one before this failed http request)
> http call, I see the Connection header attribute value set to 'close'.
> However, we indeed have the following explicit call to check stale
> connections, but still is is failing with a blank response.
> 

That basically supports my assertion. HttpClient closes the connection
based on 'close' value of the 'Connection' header and attempts to create
a new connection for the subsequent request. The server fails to handle
the incoming connection on its end and drops it without a valid
response. This still looks like a server issue to me.

Oleg   

> HttpConnectionParams.setStaleCheckingEnabled(params, true);
> 
>     <headers>
>       <requestheaders>
> 
> <header>POST /ibm/iis/isf/javahttp/checked/com.ibm.iis.isf.security.auth.AuthenticationService/login
>  HTTP/1.1</header>
>         <header>Content-Length: 1048</header>
>         <header>Content-Type: application/octet-stream</header>
>         <header>Host: hyddev15:80</header>
>         <header>Connection: Keep-Alive</header>
>         <header>User-Agent: Apache-HttpClient/IIS 4.2 (java 1.5)</header>
>         <header>Cookie: JSESSIONID=0000titWHhRyPYrO6sWcA0LST3C:-1</header>
>         <header>Cookie2: $Version=1</header>
>         <header>Authorization: Basic
> YXV0aF91c2VyXzI0NkZUT18wOmF1dGhfdXNlcl8yNDZGVE9fMA==</header>
>       </requestheaders>
>       <responseheaders>
>         <header>HTTP/1.1 200 OK</header>
>         <header>X-Powered-By: Servlet/3.0</header>
>         <header>Content-Type: application/octet-stream</header>
>         <header>Content-Language: en-US</header>
>         <header>Set-Cookie: LtpaToken2=JAAuivq99D
> +v6sR6rfq7FlVsFPnHoMwp1hTG9Pd5FPPA7gVEzGcC4lyZaLdVrQtYIy09yVVvIScN110DpQaHOi5BLMBzGdJZZw/1a5qd
> +C7nKbfjWgUQCK6ZVbACSzHsgGdcn0trVobZ/Sl3WxiDL4kys
> +cvWzTB/AmZMgarNM70tEnoav51Y1t4JCBqDq5d1K1YnFs56E6W7gJSXnOQClEqRahUW7jgvKvvHppbECMo72rDA9ftVl/d3nwrKMVXF7GxXa0w5pFMCPf
> +r4kxYPFd3sWd0shmaK2Tepe0fX05W0O93dm8/ylkdHbP02eaiMmP
> +uLnOCCX4cHK4v7lzT0HFWdwBPvDcjgUR7HqXiakv/V0lbocsp2P/mGoL
> +bwJ4j8QJSmrTI/b7MbOPIJnF9zT5/TMgASyHLKdgItNIQZB3LRP6vN4Y0YuTuD5UOLoyqYfaZHlocZBVpWSTXE8N73h4880DWKwTpleGr0WMBZRQw/39EIQu29
> +MYc4qNt2ySAXp85P8G3rdzg
> +wNQJtZXD25cVYXWmtx4r5ouOu7bLbKPkON8p/jwcnk9uOtXE3bAPO1gv18LYBGBQjxBgJKN8hPR0b41/lhRjzZL86QqodHYrSURvSAgB
> +S3ynNfAfj/h5Rf6pjJyACpQKeNoWFaAJ0JmEzBK1qGlc+Ne9Q=; Path=/;
> HttpOnly</header>
>         <header>Set-Cookie:
> X-IBM-IISSessionId=oT9YXn09/H6fquWop8A6K9VFnXL/ZSfAHRBOb5V3MqZZArOL4rErcXklDC2ToSiWWRHfSkSDNm3oNOgHu20CoDLTipBXDTrAL6n05kwpQy0jbcvMQtglMgtAXLpD
> +LqbJ1zDQPYe8UKSC4HuNSdOHc9t3oMrGksIQRtDHkwmuHQ=; Path=/; HttpOnly</header>
>         <header>Transfer-Encoding: chunked</header>
>         <header>Connection: Close</header>
>         <header>Date: Sun, 02 Sep 2012 09:59:30 GMT</header>
>         <header>Server: WebSphere Application Server/8.0</header>
>         <header>Expires: Thu, 01 Dec 1994 16:00:00 GMT</header>
>         <header>Cache-Control: no-cache=&quot;set-cookie,
> set-cookie2&quot;</header>
>       </responseheaders>
>     </headers>
> 
> Thanks,
> Ravi Chamarthy
> IBM Information Platform & Solutions
> IBM Software Group
> ravi.chamarthy@in.ibm.com
> 
> 
> 
> From:	Oleg Kalnichevski <ol...@apache.org>
> To:	httpclient-users@hc.apache.org,
> Date:	08/28/2012 05:10 PM
> Subject:	Re: Randon "ProtocolException: The server failed to respond
>             with a valid HTTP response" while executing the client request
> 
> 
> 
> On Tue, 2012-08-28 at 12:00 +0530, Ravi C Chamarthy wrote:
> > Hi,
> >
> > I am running a junit test case, where the test methods would submit http
> > client requests to the target application server (WebSphere 8) which
> hosts
> > the serving application.
> > While running the test case, I randomly run into the following error,
> where
> > in first run, say testA() would fail, and in a successive test run testA
> ()
> > would pass but some other test method, say testB() would fail with the
> same
> > error message as listed below.
> > I am not sure what is happening as it not a constant error occurring for
> > the same method.
> > What's more confusing is, the Servlet listening to the HTTP requests is
> not
> > at all called when this error occurred. And also, I do not see any error
> > messages at the server side.
> >
> 
> This exception is thrown when the server simply drops the connection in
> the middle of HTTP exchange without responding in any meaningful way.
> Quite often that can happen when the server is unable to accept new
> incoming connections due to overload or an internal problem of some
> sort. The servlet never gets called because the connection gets dropped
> by WebSphere's HTTP stack before control is passed to your web
> application.
> 
> Oleg
> 
> PS: Please do _not_ cross post.
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
> For additional commands, e-mail: httpclient-users-help@hc.apache.org
> 
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
> For additional commands, e-mail: httpclient-users-help@hc.apache.org
> 



---------------------------------------------------------------------
To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
For additional commands, e-mail: httpclient-users-help@hc.apache.org


Re: Randon "ProtocolException: The server failed to respond with a valid HTTP response" while executing the client request

Posted by Ravi C Chamarthy <ra...@in.ibm.com>.
Hi Oleg,

Thanks for your response !

I tried to capture the request/response using an HTTP Analyzer tool.
In the response of the prior (in the one before this failed http request)
http call, I see the Connection header attribute value set to 'close'.
However, we indeed have the following explicit call to check stale
connections, but still is is failing with a blank response.

HttpConnectionParams.setStaleCheckingEnabled(params, true);

    <headers>
      <requestheaders>

<header>POST /ibm/iis/isf/javahttp/checked/com.ibm.iis.isf.security.auth.AuthenticationService/login
 HTTP/1.1</header>
        <header>Content-Length: 1048</header>
        <header>Content-Type: application/octet-stream</header>
        <header>Host: hyddev15:80</header>
        <header>Connection: Keep-Alive</header>
        <header>User-Agent: Apache-HttpClient/IIS 4.2 (java 1.5)</header>
        <header>Cookie: JSESSIONID=0000titWHhRyPYrO6sWcA0LST3C:-1</header>
        <header>Cookie2: $Version=1</header>
        <header>Authorization: Basic
YXV0aF91c2VyXzI0NkZUT18wOmF1dGhfdXNlcl8yNDZGVE9fMA==</header>
      </requestheaders>
      <responseheaders>
        <header>HTTP/1.1 200 OK</header>
        <header>X-Powered-By: Servlet/3.0</header>
        <header>Content-Type: application/octet-stream</header>
        <header>Content-Language: en-US</header>
        <header>Set-Cookie: LtpaToken2=JAAuivq99D
+v6sR6rfq7FlVsFPnHoMwp1hTG9Pd5FPPA7gVEzGcC4lyZaLdVrQtYIy09yVVvIScN110DpQaHOi5BLMBzGdJZZw/1a5qd
+C7nKbfjWgUQCK6ZVbACSzHsgGdcn0trVobZ/Sl3WxiDL4kys
+cvWzTB/AmZMgarNM70tEnoav51Y1t4JCBqDq5d1K1YnFs56E6W7gJSXnOQClEqRahUW7jgvKvvHppbECMo72rDA9ftVl/d3nwrKMVXF7GxXa0w5pFMCPf
+r4kxYPFd3sWd0shmaK2Tepe0fX05W0O93dm8/ylkdHbP02eaiMmP
+uLnOCCX4cHK4v7lzT0HFWdwBPvDcjgUR7HqXiakv/V0lbocsp2P/mGoL
+bwJ4j8QJSmrTI/b7MbOPIJnF9zT5/TMgASyHLKdgItNIQZB3LRP6vN4Y0YuTuD5UOLoyqYfaZHlocZBVpWSTXE8N73h4880DWKwTpleGr0WMBZRQw/39EIQu29
+MYc4qNt2ySAXp85P8G3rdzg
+wNQJtZXD25cVYXWmtx4r5ouOu7bLbKPkON8p/jwcnk9uOtXE3bAPO1gv18LYBGBQjxBgJKN8hPR0b41/lhRjzZL86QqodHYrSURvSAgB
+S3ynNfAfj/h5Rf6pjJyACpQKeNoWFaAJ0JmEzBK1qGlc+Ne9Q=; Path=/;
HttpOnly</header>
        <header>Set-Cookie:
X-IBM-IISSessionId=oT9YXn09/H6fquWop8A6K9VFnXL/ZSfAHRBOb5V3MqZZArOL4rErcXklDC2ToSiWWRHfSkSDNm3oNOgHu20CoDLTipBXDTrAL6n05kwpQy0jbcvMQtglMgtAXLpD
+LqbJ1zDQPYe8UKSC4HuNSdOHc9t3oMrGksIQRtDHkwmuHQ=; Path=/; HttpOnly</header>
        <header>Transfer-Encoding: chunked</header>
        <header>Connection: Close</header>
        <header>Date: Sun, 02 Sep 2012 09:59:30 GMT</header>
        <header>Server: WebSphere Application Server/8.0</header>
        <header>Expires: Thu, 01 Dec 1994 16:00:00 GMT</header>
        <header>Cache-Control: no-cache=&quot;set-cookie,
set-cookie2&quot;</header>
      </responseheaders>
    </headers>

Thanks,
Ravi Chamarthy
IBM Information Platform & Solutions
IBM Software Group
ravi.chamarthy@in.ibm.com



From:	Oleg Kalnichevski <ol...@apache.org>
To:	httpclient-users@hc.apache.org,
Date:	08/28/2012 05:10 PM
Subject:	Re: Randon "ProtocolException: The server failed to respond
            with a valid HTTP response" while executing the client request



On Tue, 2012-08-28 at 12:00 +0530, Ravi C Chamarthy wrote:
> Hi,
>
> I am running a junit test case, where the test methods would submit http
> client requests to the target application server (WebSphere 8) which
hosts
> the serving application.
> While running the test case, I randomly run into the following error,
where
> in first run, say testA() would fail, and in a successive test run testA
()
> would pass but some other test method, say testB() would fail with the
same
> error message as listed below.
> I am not sure what is happening as it not a constant error occurring for
> the same method.
> What's more confusing is, the Servlet listening to the HTTP requests is
not
> at all called when this error occurred. And also, I do not see any error
> messages at the server side.
>

This exception is thrown when the server simply drops the connection in
the middle of HTTP exchange without responding in any meaningful way.
Quite often that can happen when the server is unable to accept new
incoming connections due to overload or an internal problem of some
sort. The servlet never gets called because the connection gets dropped
by WebSphere's HTTP stack before control is passed to your web
application.

Oleg

PS: Please do _not_ cross post.



---------------------------------------------------------------------
To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
For additional commands, e-mail: httpclient-users-help@hc.apache.org




---------------------------------------------------------------------
To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
For additional commands, e-mail: httpclient-users-help@hc.apache.org


Re: Randon "ProtocolException: The server failed to respond with a valid HTTP response" while executing the client request

Posted by Oleg Kalnichevski <ol...@apache.org>.
On Tue, 2012-08-28 at 12:00 +0530, Ravi C Chamarthy wrote:
> Hi,
> 
> I am running a junit test case, where the test methods would submit http
> client requests to the target application server (WebSphere 8) which hosts
> the serving application.
> While running the test case, I randomly run into the following error, where
> in first run, say testA() would fail, and in a successive test run testA()
> would pass but some other test method, say testB() would fail with the same
> error message as listed below.
> I am not sure what is happening as it not a constant error occurring for
> the same method.
> What's more confusing is, the Servlet listening to the HTTP requests is not
> at all called when this error occurred. And also, I do not see any error
> messages at the server side.
> 

This exception is thrown when the server simply drops the connection in
the middle of HTTP exchange without responding in any meaningful way.
Quite often that can happen when the server is unable to accept new
incoming connections due to overload or an internal problem of some
sort. The servlet never gets called because the connection gets dropped
by WebSphere's HTTP stack before control is passed to your web
application.

Oleg  

PS: Please do _not_ cross post.



---------------------------------------------------------------------
To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
For additional commands, e-mail: httpclient-users-help@hc.apache.org