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 / [email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to